Implement new animation system - is backwards compatible with old animations, since they only use the first 3 values, which are ultimately output identically

This commit is contained in:
George Paton 2024-01-24 16:12:15 +11:00
parent b5b3131d04
commit 5a7367624f
20 changed files with 389 additions and 357 deletions

View File

@ -18,6 +18,7 @@ import com.hbm.potion.HbmPotion;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationKeyframe; import com.hbm.render.anim.BusAnimationKeyframe;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationSequence.Dimension;
import com.hbm.render.anim.HbmAnimations.AnimType; import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay.Crosshair; import com.hbm.render.util.RenderScreenOverlay.Crosshair;
@ -70,13 +71,13 @@ public class Gun12GaugeFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL_TRANSLATE", new BusAnimationSequence() .addBus("RECOIL_TRANSLATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, -2, 100)) .addKeyframePosition(0, 0, -2, 100)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200)) .addKeyframePosition(0, 0, 0, 200)
) )
.addBus("PUMP", new BusAnimationSequence() .addBus("PUMP", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 450)) .addKeyframePosition(0, 0, 0, 450)
.addKeyframe(new BusAnimationKeyframe(0, 0, -1.8, 200)) .addKeyframePosition(0, 0, -1.8, 200)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200)) .addKeyframePosition(0, 0, 0, 200)
) )
); );
@ -110,20 +111,18 @@ public class Gun12GaugeFactory {
config.config = HbmCollection.g12hs; config.config = HbmCollection.g12hs;
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("SPAS_RECOIL_TRANSLATE", new BusAnimationSequence() .addBus("SPAS_RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, -2, 100)) .addKeyframePosition(0, 0, -2, 100)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200)) .addKeyframePosition(0, 0, 0, 200)
) .addKeyframeRotation(-10, 0, 5, 100)
.addBus("SPAS_RECOIL_ROT", new BusAnimationSequence() .addKeyframeRotation(0, 0, 0, 200)
.addKeyframe(new BusAnimationKeyframe(-1, 0, 1, 100)) )
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200)) .addBus("SPAS_PUMP", new BusAnimationSequence()
) .addKeyframe(Dimension.TZ, 0, 450)
.addBus("SPAS_PUMP", new BusAnimationSequence() .addKeyframe(Dimension.TZ, -1.8, 200)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 450)) .addKeyframe(Dimension.TZ, 0, 200)
.addKeyframe(new BusAnimationKeyframe(0, 0, -1.8, 200)) )
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200)) );
)
);
config.ejector = EJECTOR_SPAS; config.ejector = EJECTOR_SPAS;
@ -200,24 +199,24 @@ public class Gun12GaugeFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("SHOTTY_RECOIL", new BusAnimationSequence() .addBus("SHOTTY_RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0.5, 0, 0, 50)) .addKeyframePosition(0.5, 0, 0, 50)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 50)) .addKeyframePosition(0, 0, 0, 50)
) )
.addBus("SHOTTY_BREAK", new BusAnimationSequence() .addBus("SHOTTY_BREAK", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 100)) //do nothing for 100ms .addKeyframePosition(0, 0, 0, 100) //do nothing for 100ms
.addKeyframe(new BusAnimationKeyframe(0, 0, 60, 200)) //open .addKeyframePosition(0, 0, 60, 200) //open
.addKeyframe(new BusAnimationKeyframe(0, 0, 60, 500)) //do nothing for 500ms .addKeyframePosition(0, 0, 60, 500) //do nothing for 500ms
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200)) //close .addKeyframePosition(0, 0, 0, 200) //close
) )
.addBus("SHOTTY_EJECT", new BusAnimationSequence() .addBus("SHOTTY_EJECT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300)) //do nothing for 300ms .addKeyframePosition(0, 0, 0, 300) //do nothing for 300ms
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 700)) //fling! .addKeyframePosition(1, 0, 0, 700) //fling!
) )
.addBus("SHOTTY_INSERT", new BusAnimationSequence() .addBus("SHOTTY_INSERT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300)) //do nothing for 300ms .addKeyframePosition(0, 0, 0, 300) //do nothing for 300ms
.addKeyframe(new BusAnimationKeyframe(1, 0, 1, 0)) //reposition .addKeyframePosition(1, 0, 1, 0) //reposition
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 350)) //come in from the side .addKeyframePosition(1, 0, 0, 350) //come in from the side
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 150)) //push .addKeyframePosition(0, 0, 0, 150) //push
) )
); );
@ -252,26 +251,26 @@ public class Gun12GaugeFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(6.25, 0.25, 2.5, 55)) .addKeyframePosition(6.25, 0.25, 2.5, 55)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 55)) .addKeyframePosition(0, 0, 0, 55)
) )
.addBus("EJECT", new BusAnimationSequence() .addBus("EJECT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 25)) .addKeyframePosition(0, 0, 0, 25)
.addKeyframe(new BusAnimationKeyframe(25, 0, 0, 100)) .addKeyframePosition(25, 0, 0, 100)
) )
); );
config.animations.put(AnimType.RELOAD, new BusAnimation() config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("RELOAD", new BusAnimationSequence() .addBus("RELOAD", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(60, 0, -10, 400)) .addKeyframePosition(60, 0, -10, 400)
.addKeyframe(new BusAnimationKeyframe(60, 125, -10, 200)) .addKeyframePosition(60, 125, -10, 200)
.addKeyframe(new BusAnimationKeyframe(60, 125, -10, 300)) .addKeyframePosition(60, 125, -10, 300)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300)) .addKeyframePosition(0, 0, 0, 300)
) )
.addBus("PUMP", new BusAnimationSequence() .addBus("PUMP", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 900)) .addKeyframePosition(0, 0, 0, 900)
.addKeyframe(new BusAnimationKeyframe(10, 0, 0, 200)) .addKeyframePosition(10, 0, 0, 200)
.addKeyframe(new BusAnimationKeyframe()) .addKeyframePosition(0, 0, 0, 1)
) )
); );

View File

@ -50,16 +50,16 @@ public class Gun20GaugeFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("LEVER_ROTATE", new BusAnimationSequence() .addBus("LEVER_ROTATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250)) .addKeyframePosition(0, 0, 0, 250)
.addKeyframe(new BusAnimationKeyframe(0, 0, 45, 500)) .addKeyframePosition(0, 0, 45, 500)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)) .addKeyframePosition(0, 0, 0, 500)
) )
.addBus("LEVER_RECOIL", new BusAnimationSequence() .addBus("LEVER_RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0.5, 0, 0, 50)) .addKeyframePosition(0.5, 0, 0, 50)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 50)) .addKeyframePosition(0, 0, 0, 50)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 150)) .addKeyframePosition(0, 0, 0, 150)
.addKeyframe(new BusAnimationKeyframe(0, -0.5, 0, 500)) .addKeyframePosition(0, -0.5, 0, 500)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)) .addKeyframePosition(0, 0, 0, 500)
) )
); );

View File

@ -81,12 +81,12 @@ public class Gun45ACPFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("SLIDE", new BusAnimationSequence() .addBus("SLIDE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 10))// Wait for hammer .addKeyframePosition(0, 0, 0, 10)// Wait for hammer
.addKeyframe(new BusAnimationKeyframe(0, 0, -3.5, 40))// Slide back .addKeyframePosition(0, 0, -3.5, 40)// Slide back
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 40)))// Return .addKeyframePosition(0, 0, 0, 40))// Return
.addBus("HAMMER", new BusAnimationSequence() .addBus("HAMMER", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(15, 0, 0, 10)) .addKeyframePosition(15, 0, 0, 10)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 40)))); .addKeyframePosition(0, 0, 0, 40)));
return config; return config;
} }

View File

@ -109,25 +109,25 @@ public class Gun4GaugeFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("SAUER_RECOIL", new BusAnimationSequence() .addBus("SAUER_RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0.5, 0, 0, 50)) .addKeyframePosition(0.5, 0, 0, 50)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 50)) .addKeyframePosition(0, 0, 0, 50)
) )
.addBus("SAUER_TILT", new BusAnimationSequence() .addBus("SAUER_TILT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0.0, 0, 0, 200)) // do nothing for 200ms .addKeyframePosition(0.0, 0, 0, 200) // do nothing for 200ms
.addKeyframe(new BusAnimationKeyframe(0, 0, 30, 150)) //tilt forward .addKeyframePosition(0, 0, 30, 150) //tilt forward
.addKeyframe(new BusAnimationKeyframe(45, 0, 30, 150)) //tilt sideways .addKeyframePosition(45, 0, 30, 150) //tilt sideways
.addKeyframe(new BusAnimationKeyframe(45, 0, 30, 200)) //do nothing for 200ms (eject) .addKeyframePosition(45, 0, 30, 200) //do nothing for 200ms (eject)
.addKeyframe(new BusAnimationKeyframe(0, 0, 30, 150)) //restore sideways .addKeyframePosition(0, 0, 30, 150) //restore sideways
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 150)) //restore forward .addKeyframePosition(0, 0, 0, 150) //restore forward
) )
.addBus("SAUER_COCK", new BusAnimationSequence() .addBus("SAUER_COCK", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)) //do nothing for 500ms .addKeyframePosition(0, 0, 0, 500) //do nothing for 500ms
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 100)) //pull back lever for 100ms .addKeyframePosition(1, 0, 0, 100) //pull back lever for 100ms
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 100)) //release lever for 100ms .addKeyframePosition(0, 0, 0, 100) //release lever for 100ms
) )
.addBus("SAUER_SHELL_EJECT", new BusAnimationSequence() .addBus("SAUER_SHELL_EJECT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)) //do nothing for 500ms .addKeyframePosition(0, 0, 0, 500) //do nothing for 500ms
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 500)) //FLING! .addKeyframePosition(0, 0, 1, 500) //FLING!
) )
); );

View File

@ -138,20 +138,20 @@ public class Gun50BMGFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25)) .addKeyframePosition(1, 0, 0, 25)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75)) .addKeyframePosition(0, 0, 0, 75)
) )
); );
config.animations.put(AnimType.RELOAD, new BusAnimation() config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("TILT", new BusAnimationSequence() .addBus("TILT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 125)) .addKeyframePosition(1, 0, 0, 125)
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 750)) .addKeyframePosition(1, 0, 0, 750)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 125)) .addKeyframePosition(0, 0, 0, 125)
) )
.addBus("MAG", new BusAnimationSequence() .addBus("MAG", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 200)) .addKeyframePosition(0, 0, 1, 200)
.addKeyframe(new BusAnimationKeyframe(1, 0, 1, 200)) .addKeyframePosition(1, 0, 1, 200)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200)) .addKeyframePosition(0, 0, 0, 200)
) )
); );
@ -191,8 +191,8 @@ public class Gun50BMGFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25)) .addKeyframePosition(1, 0, 0, 25)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75)) .addKeyframePosition(0, 0, 0, 75)
) )
); );
@ -238,10 +238,10 @@ public class Gun50BMGFactory {
config.animations.put(AnimType.CYCLE, config.animations.put(AnimType.CYCLE,
new BusAnimation() new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(-0.45, 0.15, 0, 40)) // Moves back and raise slightly .addKeyframePosition(-0.45, 0.15, 0, 40) // Moves back and raise slightly
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75))) // Then forward again .addKeyframePosition(0, 0, 0, 75)) // Then forward again
.addBus("EJECT", new BusAnimationSequence().addKeyframe(new BusAnimationKeyframe(0, 0, 0, 30)) // Wait .addBus("EJECT", new BusAnimationSequence().addKeyframePosition(0, 0, 0, 30) // Wait
.addKeyframe(new BusAnimationKeyframe(50, 0, 0, 120)))); // Fly // out .addKeyframePosition(50, 0, 0, 120))); // Fly // out
config.ejector = EJECTOR_SNIPER; config.ejector = EJECTOR_SNIPER;
return config; return config;

View File

@ -94,8 +94,8 @@ public class Gun556mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0.5, 0, 0, 25)) .addKeyframePosition(0.5, 0, 0, 25)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75)) .addKeyframePosition(0, 0, 0, 75)
) )
); );

View File

@ -49,25 +49,25 @@ public class Gun75BoltFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25)) .addKeyframePosition(1, 0, 0, 25)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75)) .addKeyframePosition(0, 0, 0, 75)
) )
.addBus("EJECT", new BusAnimationSequence() .addBus("EJECT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 25)) .addKeyframePosition(0, 0, 0, 25)
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 75)) .addKeyframePosition(0, 0, 1, 75)
) )
); );
config.animations.put(AnimType.RELOAD, new BusAnimation() config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("TILT", new BusAnimationSequence() .addBus("TILT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 250)) .addKeyframePosition(1, 0, 0, 250)
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 1500)) .addKeyframePosition(1, 0, 0, 1500)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250)) .addKeyframePosition(0, 0, 0, 250)
) )
.addBus("MAG", new BusAnimationSequence() .addBus("MAG", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 500)) .addKeyframePosition(0, 0, 1, 500)
.addKeyframe(new BusAnimationKeyframe(1, 0, 1, 500)) .addKeyframePosition(1, 0, 1, 500)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)) .addKeyframePosition(0, 0, 0, 500)
) )
); );

View File

@ -58,15 +58,15 @@ public class Gun762mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25)) .addKeyframePosition(1, 0, 0, 25)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75)) .addKeyframePosition(0, 0, 0, 75)
) )
); );
config.animations.put(AnimType.RELOAD, new BusAnimation() config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("MAG", new BusAnimationSequence() .addBus("MAG", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, -1, 0, 500)) .addKeyframePosition(0, -1, 0, 500)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)) .addKeyframePosition(0, 0, 0, 500)
) )
); );
@ -177,19 +177,19 @@ public class Gun762mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25)) .addKeyframePosition(1, 0, 0, 25)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75)) .addKeyframePosition(0, 0, 0, 75)
) )
.addBus("LEVER_PULL", new BusAnimationSequence() .addBus("LEVER_PULL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 375)) //wait out recoil and lever flick .addKeyframePosition(0, 0, 0, 375) //wait out recoil and lever flick
.addKeyframe(new BusAnimationKeyframe(-1, 0, 0, 375)) //pull back bolt .addKeyframePosition(-1, 0, 0, 375) //pull back bolt
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 375)) //release bolt .addKeyframePosition(0, 0, 0, 375) //release bolt
) )
.addBus("LEVER_ROTATE", new BusAnimationSequence() .addBus("LEVER_ROTATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250)) //wait out recoil .addKeyframePosition(0, 0, 0, 250) //wait out recoil
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 125)) //flick up lever in 125ms .addKeyframePosition(1, 0, 0, 125) //flick up lever in 125ms
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 750)) //pull action .addKeyframePosition(1, 0, 0, 750) //pull action
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 125)) //flick down lever again .addKeyframePosition(0, 0, 0, 125) //flick down lever again
) )
); );
@ -216,19 +216,19 @@ public class Gun762mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25)) .addKeyframePosition(1, 0, 0, 25)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75)) .addKeyframePosition(0, 0, 0, 75)
) )
.addBus("LEVER_PULL", new BusAnimationSequence() .addBus("LEVER_PULL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 375)) //wait out recoil and lever flick .addKeyframePosition(0, 0, 0, 375) //wait out recoil and lever flick
.addKeyframe(new BusAnimationKeyframe(-1, 0, 0, 375)) //pull back bolt .addKeyframePosition(-1, 0, 0, 375) //pull back bolt
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 375)) //release bolt .addKeyframePosition(0, 0, 0, 375) //release bolt
) )
.addBus("LEVER_ROTATE", new BusAnimationSequence() .addBus("LEVER_ROTATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250)) //wait out recoil .addKeyframePosition(0, 0, 0, 250) //wait out recoil
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 125)) //flick up lever in 125ms .addKeyframePosition(1, 0, 0, 125) //flick up lever in 125ms
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 750)) //pull action .addKeyframePosition(1, 0, 0, 750) //pull action
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 125)) //flick down lever again .addKeyframePosition(0, 0, 0, 125) //flick down lever again
) )
); );
@ -259,19 +259,19 @@ public class Gun762mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25)) .addKeyframePosition(1, 0, 0, 25)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75)) .addKeyframePosition(0, 0, 0, 75)
) )
.addBus("LEVER_PULL", new BusAnimationSequence() .addBus("LEVER_PULL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 375)) //wait out recoil and lever flick .addKeyframePosition(0, 0, 0, 375) //wait out recoil and lever flick
.addKeyframe(new BusAnimationKeyframe(-1, 0, 0, 375)) //pull back bolt .addKeyframePosition(-1, 0, 0, 375) //pull back bolt
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 375)) //release bolt .addKeyframePosition(0, 0, 0, 375) //release bolt
) )
.addBus("LEVER_ROTATE", new BusAnimationSequence() .addBus("LEVER_ROTATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250)) //wait out recoil .addKeyframePosition(0, 0, 0, 250) //wait out recoil
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 125)) //flick up lever in 125ms .addKeyframePosition(1, 0, 0, 125) //flick up lever in 125ms
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 750)) //pull action .addKeyframePosition(1, 0, 0, 750) //pull action
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 125)) //flick down lever again .addKeyframePosition(0, 0, 0, 125) //flick down lever again
) )
); );

View File

@ -42,8 +42,8 @@ public class GunGaussFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25)) .addKeyframePosition(1, 0, 0, 25)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75)) .addKeyframePosition(0, 0, 0, 75)
) )
); );

View File

@ -84,23 +84,23 @@ public class GunRocketFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation() config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("QUADRO_RECOIL", new BusAnimationSequence() .addBus("QUADRO_RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, -0.5, 50)) .addKeyframePosition(0, 0, -0.5, 50)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 50)) .addKeyframePosition(0, 0, 0, 50)
) )
); );
config.animations.put(AnimType.RELOAD, new BusAnimation() config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("QUADRO_RELOAD_ROTATE", new BusAnimationSequence() .addBus("QUADRO_RELOAD_ROTATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 60, 750)) .addKeyframePosition(0, 0, 60, 750)
.addKeyframe(new BusAnimationKeyframe(0, 0, 60, 3500)) .addKeyframePosition(0, 0, 60, 3500)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 750)) .addKeyframePosition(0, 0, 0, 750)
) )
.addBus("QUADRO_RELOAD_PUSH", new BusAnimationSequence() .addBus("QUADRO_RELOAD_PUSH", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(-1, -1, 0, 0)) .addKeyframePosition(-1, -1, 0, 0)
.addKeyframe(new BusAnimationKeyframe(-1, -1, 0, 750)) .addKeyframePosition(-1, -1, 0, 750)
.addKeyframe(new BusAnimationKeyframe(-1, 0, 0, 500)) .addKeyframePosition(-1, 0, 0, 500)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 3000)) .addKeyframePosition(0, 0, 0, 3000)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 750)) .addKeyframePosition(0, 0, 0, 750)
) )
); );

View File

@ -128,7 +128,7 @@ public class ItemBoltgun extends Item implements IAnimatedItem {
public BusAnimation getAnimation(NBTTagCompound data, ItemStack stack) { public BusAnimation getAnimation(NBTTagCompound data, ItemStack stack) {
return new BusAnimation() return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 1, 50)) .addKeyframePosition(1, 0, 1, 50)
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 100))); .addKeyframePosition(0, 0, 1, 100));
} }
} }

View File

@ -23,16 +23,16 @@ public class ItemCoilgun extends ItemGunBase {
if(type == AnimType.CYCLE) { if(type == AnimType.CYCLE) {
return new BusAnimation() return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 100)) .addKeyframePosition(1, 0, 0, 100)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200))); .addKeyframePosition(0, 0, 0, 200));
} }
if(type == AnimType.RELOAD) { if(type == AnimType.RELOAD) {
return new BusAnimation() return new BusAnimation()
.addBus("RELOAD", new BusAnimationSequence() .addBus("RELOAD", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 250)) .addKeyframePosition(1, 0, 0, 250)
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 500)) .addKeyframePosition(1, 0, 0, 500)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250))); .addKeyframePosition(0, 0, 0, 250));
} }
GunConfiguration config = ((ItemGunBase) stack.getItem()).mainConfig; GunConfiguration config = ((ItemGunBase) stack.getItem()).mainConfig;

View File

@ -70,54 +70,54 @@ public class ItemGunBio extends ItemGunBase {
lastShot = System.currentTimeMillis(); lastShot = System.currentTimeMillis();
return new BusAnimation() return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 50)) .addKeyframePosition(0, 0, 0, 50)
.addKeyframe(new BusAnimationKeyframe(0, 0, -3, 50)) .addKeyframePosition(0, 0, -3, 50)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250)) .addKeyframePosition(0, 0, 0, 250)
) )
.addBus("HAMMER", new BusAnimationSequence() .addBus("HAMMER", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 50)) .addKeyframePosition(0, 0, 1, 50)
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 300)) .addKeyframePosition(0, 0, 1, 300)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200)) .addKeyframePosition(0, 0, 0, 200)
) )
.addBus("DRUM", new BusAnimationSequence() .addBus("DRUM", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 50)) .addKeyframePosition(0, 0, 1, 50)
); );
} }
if(type == AnimType.RELOAD) { if(type == AnimType.RELOAD) {
return new BusAnimation() return new BusAnimation()
.addBus("LATCH", new BusAnimationSequence() .addBus("LATCH", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 90, 300)) .addKeyframePosition(0, 0, 90, 300)
.addKeyframe(new BusAnimationKeyframe(0, 0, 90, 2000)) .addKeyframePosition(0, 0, 90, 2000)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 150)) .addKeyframePosition(0, 0, 0, 150)
) )
.addBus("FRONT", new BusAnimationSequence() .addBus("FRONT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200)) .addKeyframePosition(0, 0, 0, 200)
.addKeyframe(new BusAnimationKeyframe(0, 0, 45, 150)) .addKeyframePosition(0, 0, 45, 150)
.addKeyframe(new BusAnimationKeyframe(0, 0, 45, 2000)) .addKeyframePosition(0, 0, 45, 2000)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75)) .addKeyframePosition(0, 0, 0, 75)
) )
.addBus("RELOAD_ROT", new BusAnimationSequence() .addBus("RELOAD_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300)) .addKeyframePosition(0, 0, 0, 300)
.addKeyframe(new BusAnimationKeyframe(60, 0, 0, 500)) .addKeyframePosition(60, 0, 0, 500)
.addKeyframe(new BusAnimationKeyframe(60, 0, 0, 500)) .addKeyframePosition(60, 0, 0, 500)
.addKeyframe(new BusAnimationKeyframe(0, -90, -90, 0)) .addKeyframePosition(0, -90, -90, 0)
.addKeyframe(new BusAnimationKeyframe(0, -90, -90, 600)) .addKeyframePosition(0, -90, -90, 600)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300)) .addKeyframePosition(0, 0, 0, 300)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 100)) .addKeyframePosition(0, 0, 0, 100)
.addKeyframe(new BusAnimationKeyframe(-45, 0, 0, 50)) .addKeyframePosition(-45, 0, 0, 50)
.addKeyframe(new BusAnimationKeyframe(-45, 0, 0, 100)) .addKeyframePosition(-45, 0, 0, 100)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300)) .addKeyframePosition(0, 0, 0, 300)
) )
.addBus("RELOAD_MOVE", new BusAnimationSequence() .addBus("RELOAD_MOVE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300)) .addKeyframePosition(0, 0, 0, 300)
.addKeyframe(new BusAnimationKeyframe(0, -15, 0, 1000)) .addKeyframePosition(0, -15, 0, 1000)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 450)) .addKeyframePosition(0, 0, 0, 450)
) )
.addBus("DRUM_PUSH", new BusAnimationSequence() .addBus("DRUM_PUSH", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 1600)) .addKeyframePosition(0, 0, 0, 1600)
.addKeyframe(new BusAnimationKeyframe(0, 0, -5, 0)) .addKeyframePosition(0, 0, -5, 0)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300)) .addKeyframePosition(0, 0, 0, 300)
); );
} }

View File

@ -23,12 +23,12 @@ public class ItemGunCongo extends ItemGunBase {
if(type == AnimType.CYCLE) { if(type == AnimType.CYCLE) {
return new BusAnimation() return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 50)) .addKeyframePosition(1, 0, 0, 50)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 100))) .addKeyframePosition(0, 0, 0, 100))
.addBus("PUMP", new BusAnimationSequence() .addBus("PUMP", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)) .addKeyframePosition(0, 0, 0, 500)
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 100)) .addKeyframePosition(1, 0, 0, 100)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200))); .addKeyframePosition(0, 0, 0, 200));
} }

View File

@ -65,7 +65,7 @@ public class ItemGunPip extends ItemGunBase {
if(type == AnimType.EQUIP) { if(type == AnimType.EQUIP) {
return new BusAnimation() return new BusAnimation()
.addBus("ROTATE", new BusAnimationSequence() .addBus("ROTATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(-360, 0, 0, 350)) .addKeyframePosition(-360, 0, 0, 350)
); );
} }
@ -74,17 +74,17 @@ public class ItemGunPip extends ItemGunBase {
int s = 1; int s = 1;
return new BusAnimation() return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence() .addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 50 * s)) .addKeyframePosition(0, 0, 0, 50 * s)
.addKeyframe(new BusAnimationKeyframe(0, 0, -3, 50 * s)) .addKeyframePosition(0, 0, -3, 50 * s)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250 * s)) .addKeyframePosition(0, 0, 0, 250 * s)
) )
.addBus("HAMMER", new BusAnimationSequence() .addBus("HAMMER", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 50 * s)) .addKeyframePosition(0, 0, 1, 50 * s)
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 300 * s)) .addKeyframePosition(0, 0, 1, 300 * s)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200 * s)) .addKeyframePosition(0, 0, 0, 200 * s)
) )
.addBus("DRUM", new BusAnimationSequence() .addBus("DRUM", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 50 * s)) .addKeyframePosition(0, 0, 1, 50 * s)
); );
} }
@ -92,44 +92,44 @@ public class ItemGunPip extends ItemGunBase {
int s = 1; int s = 1;
return new BusAnimation() return new BusAnimation()
.addBus("RELAOD_TILT", new BusAnimationSequence() .addBus("RELAOD_TILT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(-15, 0, 0, 100 * s)) .addKeyframePosition(-15, 0, 0, 100 * s)
.addKeyframe(new BusAnimationKeyframe(65, 0, 0, 100 * s)) //200 .addKeyframePosition(65, 0, 0, 100 * s) //200
.addKeyframe(new BusAnimationKeyframe(45, 0, 0, 50 * s)) //250 .addKeyframePosition(45, 0, 0, 50 * s) //250
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200 * s)) //450 .addKeyframePosition(0, 0, 0, 200 * s) //450
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 1450 * s)) //1900 .addKeyframePosition(0, 0, 0, 1450 * s) //1900
.addKeyframe(new BusAnimationKeyframe(-80, 0, 0, 100 * s)) //2000 .addKeyframePosition(-80, 0, 0, 100 * s) //2000
.addKeyframe(new BusAnimationKeyframe(-80, 0, 0, 100 * s)) //2100 .addKeyframePosition(-80, 0, 0, 100 * s) //2100
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200 * s)) //2300 .addKeyframePosition(0, 0, 0, 200 * s) //2300
) )
.addBus("RELOAD_CYLINDER", new BusAnimationSequence() .addBus("RELOAD_CYLINDER", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200 * s)) .addKeyframePosition(0, 0, 0, 200 * s)
.addKeyframe(new BusAnimationKeyframe(90, 0, 0, 100 * s)) //300 .addKeyframePosition(90, 0, 0, 100 * s) //300
.addKeyframe(new BusAnimationKeyframe(90, 0, 0, 1700 * s)) //2000 .addKeyframePosition(90, 0, 0, 1700 * s) //2000
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 70 * s)) //2100 .addKeyframePosition(0, 0, 0, 70 * s) //2100
) )
.addBus("RELOAD_LIFT", new BusAnimationSequence() .addBus("RELOAD_LIFT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 350 * s)) .addKeyframePosition(0, 0, 0, 350 * s)
.addKeyframe(new BusAnimationKeyframe(-45, 0, 0, 250 * s)) //600 .addKeyframePosition(-45, 0, 0, 250 * s) //600
.addKeyframe(new BusAnimationKeyframe(-45, 0, 0, 350 * s)) //950 .addKeyframePosition(-45, 0, 0, 350 * s) //950
.addKeyframe(new BusAnimationKeyframe(-15, 0, 0, 200 * s)) //1150 .addKeyframePosition(-15, 0, 0, 200 * s) //1150
.addKeyframe(new BusAnimationKeyframe(-15, 0, 0, 1050 * s)) //2200 .addKeyframePosition(-15, 0, 0, 1050 * s) //2200
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 100 * s)) //2300 .addKeyframePosition(0, 0, 0, 100 * s) //2300
) )
.addBus("RELOAD_JOLT", new BusAnimationSequence() .addBus("RELOAD_JOLT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 600 * s)) .addKeyframePosition(0, 0, 0, 600 * s)
.addKeyframe(new BusAnimationKeyframe(2, 0, 0, 50 * s)) //650 .addKeyframePosition(2, 0, 0, 50 * s) //650
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 100 * s)) //750 .addKeyframePosition(0, 0, 0, 100 * s) //750
) )
.addBus("RELOAD_BULLETS", new BusAnimationSequence() .addBus("RELOAD_BULLETS", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 650 * s)) .addKeyframePosition(0, 0, 0, 650 * s)
.addKeyframe(new BusAnimationKeyframe(10, 0, 0, 300 * s)) //950 .addKeyframePosition(10, 0, 0, 300 * s) //950
.addKeyframe(new BusAnimationKeyframe(10, 0, 0, 200 * s)) //1150 .addKeyframePosition(10, 0, 0, 200 * s) //1150
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 700 * s)) //1850 .addKeyframePosition(0, 0, 0, 700 * s) //1850
) )
.addBus("RELOAD_BULLETS_CON", new BusAnimationSequence() .addBus("RELOAD_BULLETS_CON", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 0 * s)) .addKeyframePosition(1, 0, 0, 0 * s)
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 950 * s)) .addKeyframePosition(1, 0, 0, 950 * s)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 1 * s)) .addKeyframePosition(0, 0, 0, 1 * s)
); );
} }

View File

@ -1740,9 +1740,9 @@ public class ClientProxy extends ServerProxy {
BusAnimation animation = new BusAnimation() BusAnimation animation = new BusAnimation()
.addBus("GUARD_ROT", new BusAnimationSequence() .addBus("GUARD_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(90, 0, 1, 0)) .addKeyframePosition(90, 0, 1, 0)
.addKeyframe(new BusAnimationKeyframe(90, 0, 1, 800)) .addKeyframePosition(90, 0, 1, 800)
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 50))); .addKeyframePosition(0, 0, 1, 50));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation); HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
} }
@ -1756,13 +1756,13 @@ public class ClientProxy extends ServerProxy {
BusAnimation animation = new BusAnimation() BusAnimation animation = new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence() .addBus("SWING_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(90 - offset, 90 - offset, 35, 75)) .addKeyframePosition(90 - offset, 90 - offset, 35, 75)
.addKeyframe(new BusAnimationKeyframe(90 + offset, 90 - offset, -45, 150)) .addKeyframePosition(90 + offset, 90 - offset, -45, 150)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500))) .addKeyframePosition(0, 0, 0, 500))
.addBus("SWING_TRANS", new BusAnimationSequence() .addBus("SWING_TRANS", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(-3, 0, 0, 75)) .addKeyframePosition(-3, 0, 0, 75)
.addKeyframe(new BusAnimationKeyframe(8, 0, 0, 150)) .addKeyframePosition(8, 0, 0, 150)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500))); .addKeyframePosition(0, 0, 0, 500));
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:weapon.cSwing"), 0.8F + player.getRNG().nextFloat() * 0.2F)); Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:weapon.cSwing"), 0.8F + player.getRNG().nextFloat() * 0.2F));
@ -1781,13 +1781,13 @@ public class ClientProxy extends ServerProxy {
BusAnimation animation = new BusAnimation() BusAnimation animation = new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence() .addBus("SWING_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 90, forward)) .addKeyframePosition(0, 0, 90, forward)
.addKeyframe(new BusAnimationKeyframe(45, 0, 90, sideways)) .addKeyframePosition(45, 0, 90, sideways)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, retire))) .addKeyframePosition(0, 0, 0, retire))
.addBus("SWING_TRANS", new BusAnimationSequence() .addBus("SWING_TRANS", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 3, forward)) .addKeyframePosition(0, 0, 3, forward)
.addKeyframe(new BusAnimationKeyframe(2, 0, 2, sideways)) .addKeyframePosition(2, 0, 2, sideways)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, retire))); .addKeyframePosition(0, 0, 0, retire));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation); HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
@ -1801,15 +1801,15 @@ public class ClientProxy extends ServerProxy {
BusAnimation animation = new BusAnimation() BusAnimation animation = new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence() .addBus("SWING_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(rot[0], rot[1], rot[2], 0)) .addKeyframePosition(rot[0], rot[1], rot[2], 0)
.addKeyframe(new BusAnimationKeyframe(0, 0, 90, forward)) .addKeyframePosition(0, 0, 90, forward)
.addKeyframe(new BusAnimationKeyframe(45, 0, 90, sideways)) .addKeyframePosition(45, 0, 90, sideways)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, retire))) .addKeyframePosition(0, 0, 0, retire))
.addBus("SWING_TRANS", new BusAnimationSequence() .addBus("SWING_TRANS", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(trans[0], trans[1], trans[2], 0)) .addKeyframePosition(trans[0], trans[1], trans[2], 0)
.addKeyframe(new BusAnimationKeyframe(0, 0, 3, forward)) .addKeyframePosition(0, 0, 3, forward)
.addKeyframe(new BusAnimationKeyframe(2, 0, 2, sideways)) .addKeyframePosition(2, 0, 2, sideways)
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, retire))); .addKeyframePosition(0, 0, 0, retire));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation); HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
} }

View File

@ -8,46 +8,55 @@ public class BusAnimationKeyframe {
//two frames could be implemented //two frames could be implemented
public static enum InterpolationType { public static enum InterpolationType {
NONE, NONE,
SMOOTH LINEAR
} }
//unimplemented, all current animations are absolute // public double x;
//whether the transformation happens on its own or relative to the last state // public double y;
//i.e. 5 with 15 being the previous would be 20 additive and 5 absolute, simple enough // public double z;
public static enum StateType {
ADDITIVE,
ABSOLTE
}
public double x; public double value;
public double y;
public double z;
public InterpolationType interpolationType; public InterpolationType interpolationType;
public int duration; public int duration;
public double[] toArray() { // public double[] toArray() {
return new double[] {x, y, z}; // return new double[] {x, y, z};
} // }
//this one can be used for "reset" type keyframes //this one can be used for "reset" type keyframes
public BusAnimationKeyframe() { public BusAnimationKeyframe() {
this.x = 0; // this.x = 0;
this.y = 0; // this.y = 0;
this.z = 0; // this.z = 0;
this.value = 0;
this.duration = 1; this.duration = 1;
this.interpolationType = InterpolationType.SMOOTH; this.interpolationType = InterpolationType.LINEAR;
} }
public BusAnimationKeyframe(double x, double y, double z, int duration) { public BusAnimationKeyframe(double value, int duration) {
this(); this();
this.x = x; this.value = value;
this.y = y;
this.z = z;
this.duration = duration; this.duration = duration;
} }
public BusAnimationKeyframe(double x, double y, double z, int duration, InterpolationType interpolation) { public BusAnimationKeyframe(double value, int duration, InterpolationType interpolation) {
this(x, y, z, duration); this(value, duration);
this.interpolationType = interpolation; this.interpolationType = interpolation;
} }
// public BusAnimationKeyframe(double x, double y, double z, int duration) {
// this();
// this.x = x;
// this.y = y;
// this.z = z;
// this.duration = duration;
// }
// public BusAnimationKeyframe(double x, double y, double z, int duration, InterpolationType interpolation) {
// this(x, y, z, duration);
// this.interpolationType = interpolation;
// }
} }

View File

@ -8,104 +8,119 @@ import com.hbm.render.anim.BusAnimationKeyframe.InterpolationType;
//the actual bus, a sequence of keyframes with their own behavior and such //the actual bus, a sequence of keyframes with their own behavior and such
public class BusAnimationSequence { public class BusAnimationSequence {
//not actually useful for anything since the renderer usually handles public static enum Dimension {
//this part, but it's nice to have for distinction just in case TX,
public static enum EnumTransformation { TY,
UNDEFINED, TZ,
ROTATION, RX,
TRANSLATION, RY,
SCALE RZ,
SX,
SY,
SZ
} }
private List<BusAnimationKeyframe> keyframes = new ArrayList();
public EnumTransformation transformationType;
//appends a keyframe at the end of the sequence // Storing a matrix of keyframe data, each keyframe stores a SINGLE dimension, so we can stagger frames over each parameter
public BusAnimationSequence addKeyframe(BusAnimationKeyframe keyframe) { private List<List<BusAnimationKeyframe>> transformKeyframes = new ArrayList<List<BusAnimationKeyframe>>(9);
keyframes.add(keyframe);
public BusAnimationSequence() {
// Initialise our keyframe storage, since it's multidimensional
for (int i = 0; i < 9; i++) {
transformKeyframes.add(new ArrayList<BusAnimationKeyframe>());
}
}
// Adds a keyframe to the given dimension
public BusAnimationSequence addKeyframe(Dimension dimension, BusAnimationKeyframe keyframe) {
transformKeyframes.get(dimension.ordinal()).add(keyframe);
return this; return this;
} }
public BusAnimationSequence addKeyframe(Dimension dimension, double value, int duration) {
transformKeyframes.get(dimension.ordinal()).add(new BusAnimationKeyframe(value, duration));
return this;
}
// Two helper methods for the old hard-coded animations
public BusAnimationSequence addKeyframePosition(double x, double y, double z, int duration) {
addKeyframe(Dimension.TX, new BusAnimationKeyframe(x, duration));
addKeyframe(Dimension.TY, new BusAnimationKeyframe(y, duration));
addKeyframe(Dimension.TZ, new BusAnimationKeyframe(z, duration));
return this;
}
public BusAnimationSequence addKeyframeRotation(double x, double y, double z, int duration) {
addKeyframe(Dimension.RX, new BusAnimationKeyframe(x, duration));
addKeyframe(Dimension.RY, new BusAnimationKeyframe(y, duration));
addKeyframe(Dimension.RZ, new BusAnimationKeyframe(z, duration));
return this;
}
//all transformation data is absolute, additive transformations have not yet been implemented //all transformation data is absolute, additive transformations have not yet been implemented
public double[] getTransformation(int millis) { public double[] getTransformation(int millis) {
double[] transform = new double[9];
BusAnimationKeyframe frame = getFrameAtTime(millis); for (int i = 0; i < 9; i++) {
List<BusAnimationKeyframe> keyframes = transformKeyframes.get(i);
if(frame == null) BusAnimationKeyframe currentFrame = null;
return null; BusAnimationKeyframe previousFrame = null;
//if no interpolation type is set, just return the new coords int startTime = 0;
if(frame.interpolationType == InterpolationType.NONE) int endTime = 0;
return frame.toArray(); for (BusAnimationKeyframe keyframe: keyframes) {
startTime = endTime;
endTime += keyframe.duration;
previousFrame = currentFrame;
currentFrame = keyframe;
if (millis < endTime) break;
}
//if this is the first frame, the "previous" values are 0 if (currentFrame == null || millis >= endTime) {
double[] previous = new double[] {0, 0, 0}; // Scale defaults to 1, others are 0
transform[i] = i >= 6 ? 1 : 0;
continue;
}
BusAnimationKeyframe lastFrame = getPreviousFrame(frame); if (currentFrame.interpolationType == InterpolationType.NONE) {
transform[i] = currentFrame.value;
continue;
}
if(lastFrame != null) double a = currentFrame.value;
previous = lastFrame.toArray(); double b = previousFrame != null ? previousFrame.value : 0;
double t = (double)(millis - startTime) / (double)currentFrame.duration;
//the time elapsed during the frame is the total current time minus the starting timie of the current frame transform[i] = (a - b) * t + b;
int frameTime = millis - getStartingTime(frame);
double interpolation = (double)frameTime / (double)frame.duration;
double interX = (frame.x - previous[0]) * interpolation + previous[0];
double interY = (frame.y - previous[1]) * interpolation + previous[1];
double interZ = (frame.z - previous[2]) * interpolation + previous[2];
return new double[] {interX, interY, interZ};
}
public BusAnimationKeyframe getFrameAtTime(int millis) {
int time = 0;
for(BusAnimationKeyframe frame : keyframes) {
time += frame.duration;
if(millis < time)
return frame;
} }
return null; return transform;
}
public BusAnimationKeyframe getPreviousFrame(BusAnimationKeyframe frame) {
int index = keyframes.indexOf(frame);
if(index == 0)
return null;
return keyframes.get(index - 1);
}
public int getStartingTime(BusAnimationKeyframe start) {
int time = 0;
for(BusAnimationKeyframe frame : keyframes) {
if(frame == start)
break;
time += frame.duration;
}
return time;
} }
public int getTotalTime() { public int getTotalTime() {
int highestTime = 0;
int time = 0; for (List<BusAnimationKeyframe> keyframes: transformKeyframes) {
int time = 0;
for (BusAnimationKeyframe frame: keyframes) {
time += frame.duration;
}
for(BusAnimationKeyframe frame : keyframes) { highestTime = Math.max(time, highestTime);
time += frame.duration;
} }
return time; return highestTime;
} }
} }

View File

@ -4,6 +4,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
public class HbmAnimations { public class HbmAnimations {
//in flans mod and afaik also MW, there's an issue that there is only one //in flans mod and afaik also MW, there's an issue that there is only one
@ -83,7 +85,21 @@ public class HbmAnimations {
} }
} }
return new double[] {0, 0, 0}; return new double[] {
0, 0, 0, // position
0, 0, 0, // rotation
1, 1, 1 // scale
};
}
public static void applyRelevantTransformation(String bus) {
double[] transform = getRelevantTransformation(bus);
GL11.glTranslated(transform[0], transform[1], transform[2]);
GL11.glRotated(transform[3], 1, 0, 0);
GL11.glRotated(transform[4], 0, 1, 0);
GL11.glRotated(transform[5], 0, 0, 1);
GL11.glScaled(transform[6], transform[7], transform[8]);
} }
} }

View File

@ -44,24 +44,17 @@ public class ItemRenderWeaponSpas12 implements IItemRenderer {
case EQUIPPED_FIRST_PERSON: case EQUIPPED_FIRST_PERSON:
double[] recoilT = HbmAnimations.getRelevantTransformation("SPAS_RECOIL_TRANSLATE");
double[] recoilR = HbmAnimations.getRelevantTransformation("SPAS_RECOIL_ROT");
double[] pump = HbmAnimations.getRelevantTransformation("SPAS_PUMP");
double s0 = 0.5D; double s0 = 0.5D;
GL11.glRotated(25, 0, 0, 1); GL11.glRotated(25, 0, 0, 1);
GL11.glTranslated(0, -0.8, 0.1); GL11.glTranslated(0, -0.8, 0.1);
GL11.glRotated(80, 0, 1, 0); GL11.glRotated(80, 0, 1, 0);
GL11.glScaled(s0, s0, s0); GL11.glScaled(s0, s0, s0);
int m = 2; HbmAnimations.applyRelevantTransformation("SPAS_RECOIL");
GL11.glTranslated(recoilT[0]*m, recoilT[1]*m, recoilT[2]*m);
GL11.glRotated(2, recoilR[0]*m, recoilR[1]*m, recoilR[2]*m);
ResourceManager.spas_12.renderPart("MainBody"); ResourceManager.spas_12.renderPart("MainBody");
GL11.glTranslated(pump[0], pump[1], pump[2]); HbmAnimations.applyRelevantTransformation("SPAS_PUMP");
ResourceManager.spas_12.renderPart("PumpGrip"); ResourceManager.spas_12.renderPart("PumpGrip");