Merge pull request #1318 from MellowArpeggiation/animation-rework

Weapon animation rework
This commit is contained in:
HbmMods 2024-01-31 08:18:50 +01:00 committed by GitHub
commit df5eef4182
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
45 changed files with 13141 additions and 15848 deletions

BIN
ntm-animator.blend Normal file

Binary file not shown.

View File

@ -3,6 +3,7 @@ package com.hbm.handler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.function.Consumer;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.render.anim.BusAnimation;
@ -35,7 +36,10 @@ public class GunConfiguration implements Cloneable {
public int durability;
//animations!
public HashMap<AnimType, BusAnimation> animations = new HashMap();
public HashMap<AnimType, BusAnimation> animations = new HashMap<AnimType, BusAnimation>();
//lazy-ish loading for animations, required for loading animations from ResourceManager, since that occurs after we've initialised the guns
public Consumer<Void> loadAnimations;
public boolean animationsLoaded = false;
//when sneaking, disables crosshair and centers the bullet spawn point
public boolean hasSights;
//texture overlay when sneaking
@ -45,17 +49,18 @@ public class GunConfiguration implements Cloneable {
//the target FOV/multiplied FOV modifier when sneaking
public float zoomFOV = 0.0F;
//how long the reload animation will play
//MUST BE GREATER THAN ZERO ! ! !
public int reloadDuration;
//duration of every animation cycle, used also for how quickly a burst fire rifle can fire
public int firingDuration;
//sound path to the reload sound
public String reloadSound = "";
//sound path to the shooting sound
public String firingSound = "";
public float firingVolume = 1.0F;
public float firingPitch = 1.0F;
//how long the reload animation will play
//MUST BE GREATER THAN ZERO ! ! !
public int reloadDuration;
public int emptyReloadAdditionalDuration;
//sound path to the reload sound
public String reloadSound = "";
//whether the reload sound should be played at the beginning or at the end of the reload
public boolean reloadSoundEnd = true;
public String equipSound = "";
@ -64,6 +69,8 @@ public class GunConfiguration implements Cloneable {
public int ammoCap;
//0 does not allow direct reload, 1 is full clip, 2 is single bullet
public int reloadType;
// If the animations are designed to be sequential, the last frame will be held until the next anmiation starts
public boolean reloadAnimationsSequential = false;
//whether or not the infinity enchantment should work
public boolean allowsInfinity;
//whether the ammo count should be displayed
@ -79,10 +86,10 @@ public class GunConfiguration implements Cloneable {
public String name = "";
public EnumGunManufacturer manufacturer = EnumGunManufacturer.NONE;
public List<String> comment = new ArrayList();
public List<String> comment = new ArrayList<String>();
//bullet configs for main and alt fire
public List<Integer> config = new ArrayList();
public List<Integer> config = new ArrayList<Integer>();
//crosshair
public Crosshair crosshair;

View File

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

View File

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

View File

@ -10,10 +10,12 @@ import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.items.ItemAmmoEnums.Ammo357Magnum;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.lib.ModDamageSource;
import com.hbm.potion.HbmPotion;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import net.minecraft.potion.PotionEffect;
@ -39,7 +41,7 @@ public class Gun357MagnumFactory {
config.roundsPerCycle = 1;
config.gunMode = GunConfiguration.MODE_NORMAL;
config.firingMode = GunConfiguration.FIRE_MANUAL;
config.reloadDuration = 10;
config.reloadDuration = 30;
config.firingDuration = 0;
config.ammoCap = 6;
config.reloadType = GunConfiguration.RELOAD_FULL;
@ -50,6 +52,11 @@ public class Gun357MagnumFactory {
config.reloadSoundEnd = false;
config.ejector = EJECTOR_REVOLVER;
config.loadAnimations = i -> {
config.animations.put(AnimType.CYCLE, ResourceManager.python_anim.get("Fire"));
config.animations.put(AnimType.RELOAD, ResourceManager.python_anim.get("Reload"));
};
return config;
}
@ -122,6 +129,11 @@ public class Gun357MagnumFactory {
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.CURSED_REVOLVER);
config.config.add(BulletConfigSyncingUtil.DESH_REVOLVER);
config.loadAnimations = i -> {
config.animations.put(AnimType.CYCLE, ResourceManager.cursed_anim.get("Fire"));
config.animations.put(AnimType.RELOAD, ResourceManager.cursed_anim.get("Reload"));
};
return config;
}
@ -242,7 +254,7 @@ public class Gun357MagnumFactory {
bullet.dmgMin = 10;
bullet.dmgMax = 15;
bullet.effects = new ArrayList();
bullet.effects = new ArrayList<PotionEffect>();
bullet.effects.add(new PotionEffect(HbmPotion.radiation.id, 10 * 20, 4));
bullet.spentCasing = CASING357.clone().register("357Nuc").setColor(0xFEFEFE);
@ -328,8 +340,8 @@ public class Gun357MagnumFactory {
bullet.dmgMax = 100;
bullet.doesRicochet = false;
bullet.destroysBlocks = true;
bullet.style = bullet.STYLE_BOLT;
bullet.trail = bullet.BOLT_NIGHTMARE;
bullet.style = BulletConfiguration.STYLE_BOLT;
bullet.trail = BulletConfiguration.BOLT_NIGHTMARE;
bullet.damageType = ModDamageSource.s_laser;

View File

@ -15,12 +15,14 @@ import com.hbm.items.ModItems;
import com.hbm.items.ItemAmmoEnums.Ammo44Magnum;
import com.hbm.lib.HbmCollection;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.potion.HbmPotion;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
@ -60,6 +62,10 @@ public class Gun44MagnumFactory {
config.config.addAll(HbmCollection.m44Normal);
config.ejector = EJECTOR_PIP;
config.loadAnimations = i -> {
config.animations.put(AnimType.CYCLE, ResourceManager.novac_anim.get("Fire"));
};
return config;
}
@ -220,7 +226,7 @@ public class Gun44MagnumFactory {
PotionEffect eff = new PotionEffect(HbmPotion.phosphorus.id, 20 * 20, 0, true);
eff.getCurativeItems().clear();
bullet.effects = new ArrayList();
bullet.effects = new ArrayList<PotionEffect>();
bullet.effects.add(new PotionEffect(eff));
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {

View File

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

View File

@ -17,6 +17,7 @@ import com.hbm.items.ModItems;
import com.hbm.items.ItemAmmoEnums.Ammo4Gauge;
import com.hbm.lib.HbmCollection;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.main.ResourceManager;
import com.hbm.lib.ModDamageSource;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
@ -24,7 +25,6 @@ import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.potion.HbmPotion;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationKeyframe;
import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
@ -84,6 +84,18 @@ public class Gun4GaugeFactory {
config.name = "ks23";
config.manufacturer = EnumGunManufacturer.TULSKY;
config.emptyReloadAdditionalDuration = 5;
config.reloadAnimationsSequential = true;
config.loadAnimations = i -> {
config.animations.put(AnimType.CYCLE, ResourceManager.ks23_anim.get("Fire"));
config.animations.put(AnimType.RELOAD, ResourceManager.ks23_anim.get("ReloadStart"));
config.animations.put(AnimType.RELOAD_EMPTY, ResourceManager.ks23_anim.get("ReloadEmptyStart"));
config.animations.put(AnimType.RELOAD_CYCLE, ResourceManager.ks23_anim.get("Reload"));
config.animations.put(AnimType.RELOAD_END, ResourceManager.ks23_anim.get("ReloadEnd"));
};
config.config = HbmCollection.g4;
return config;
@ -109,25 +121,25 @@ public class Gun4GaugeFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("SAUER_RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0.5, 0, 0, 50))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 50))
.addKeyframePosition(0.5, 0, 0, 50)
.addKeyframePosition(0, 0, 0, 50)
)
.addBus("SAUER_TILT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0.0, 0, 0, 200)) // do nothing for 200ms
.addKeyframe(new BusAnimationKeyframe(0, 0, 30, 150)) //tilt forward
.addKeyframe(new BusAnimationKeyframe(45, 0, 30, 150)) //tilt sideways
.addKeyframe(new BusAnimationKeyframe(45, 0, 30, 200)) //do nothing for 200ms (eject)
.addKeyframe(new BusAnimationKeyframe(0, 0, 30, 150)) //restore sideways
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 150)) //restore forward
.addKeyframePosition(0.0, 0, 0, 200) // do nothing for 200ms
.addKeyframePosition(0, 0, 30, 150) //tilt forward
.addKeyframePosition(45, 0, 30, 150) //tilt sideways
.addKeyframePosition(45, 0, 30, 200) //do nothing for 200ms (eject)
.addKeyframePosition(0, 0, 30, 150) //restore sideways
.addKeyframePosition(0, 0, 0, 150) //restore forward
)
.addBus("SAUER_COCK", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)) //do nothing for 500ms
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 100)) //pull back lever for 100ms
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 100)) //release lever for 100ms
.addKeyframePosition(0, 0, 0, 500) //do nothing for 500ms
.addKeyframePosition(1, 0, 0, 100) //pull back lever for 100ms
.addKeyframePosition(0, 0, 0, 100) //release lever for 100ms
)
.addBus("SAUER_SHELL_EJECT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)) //do nothing for 500ms
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 500)) //FLING!
.addKeyframePosition(0, 0, 0, 500) //do nothing for 500ms
.addKeyframePosition(0, 0, 1, 500) //FLING!
)
);
@ -203,7 +215,7 @@ public class Gun4GaugeFactory {
PotionEffect eff = new PotionEffect(HbmPotion.phosphorus.id, 20 * 20, 0, true);
eff.getCurativeItems().clear();
bullet.effects = new ArrayList();
bullet.effects = new ArrayList<PotionEffect>();
bullet.effects.add(new PotionEffect(eff));
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
@ -494,7 +506,7 @@ public class Gun4GaugeFactory {
BulletConfigFactory.nuclearExplosion(creature, 0, 0, 0, ExplosionNukeSmall.PARAMS_TOTS);
bulletnt.worldObj.removeEntity(creature);
bulletnt.worldObj.unloadEntities(new ArrayList() {{ add(creature); }});
bulletnt.worldObj.unloadEntities(new ArrayList<EntityCreature>() {{ add(creature); }});
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -84,23 +84,23 @@ public class GunRocketFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("QUADRO_RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, -0.5, 50))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 50))
.addKeyframePosition(0, 0, -0.5, 50)
.addKeyframePosition(0, 0, 0, 50)
)
);
config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("QUADRO_RELOAD_ROTATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 60, 750))
.addKeyframe(new BusAnimationKeyframe(0, 0, 60, 3500))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 750))
.addKeyframePosition(0, 0, 60, 750)
.addKeyframePosition(0, 0, 60, 3500)
.addKeyframePosition(0, 0, 0, 750)
)
.addBus("QUADRO_RELOAD_PUSH", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(-1, -1, 0, 0))
.addKeyframe(new BusAnimationKeyframe(-1, -1, 0, 750))
.addKeyframe(new BusAnimationKeyframe(-1, 0, 0, 500))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 3000))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 750))
.addKeyframePosition(-1, -1, 0, 0)
.addKeyframePosition(-1, -1, 0, 750)
.addKeyframePosition(-1, 0, 0, 500)
.addKeyframePosition(0, 0, 0, 3000)
.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) {
return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 1, 50))
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 100)));
.addKeyframePosition(1, 0, 1, 50)
.addKeyframePosition(0, 0, 1, 100));
}
}

View File

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

View File

@ -376,17 +376,20 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
ammo.stacksize = toConsume;
setMag(stack, getMag(stack) + toAdd);
if (getMag(stack) >= mainConfig.ammoCap)
if (getMag(stack) >= mainConfig.ammoCap) {
setIsReloading(stack, false);
else
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.RELOAD_END.ordinal()), (EntityPlayerMP) player);
} else {
resetReloadCycle(player, stack);
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.RELOAD_CYCLE.ordinal()), (EntityPlayerMP) player);
}
if(hasLoaded && mainConfig.reloadSoundEnd)
world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F);
if(mainConfig.ejector != null && mainConfig.ejector.getAfterReload())
queueCasing(player, mainConfig.ejector, prevCfg, stack);
InventoryUtil.tryConsumeAStack(player.inventory.mainInventory, 0, player.inventory.mainInventory.length - 1, ammo);
} else {
setReloadCycle(stack, getReloadCycle(stack) - 1);
@ -403,8 +406,8 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
if(player.isSneaking() && hasInfinity(stack, mainConfig)) {
if(this.getMag(stack) == mainConfig.ammoCap) {
this.setMag(stack, 0);
if(getMag(stack) == mainConfig.ammoCap) {
setMag(stack, 0);
this.resetAmmoType(stack, world, player);
world.playSoundAtEntity(player, "tile.piston.out", 1.0F, 1.0F);
}
@ -412,7 +415,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
return;
}
if(this.getMag(stack) == mainConfig.ammoCap)
if(getMag(stack) == mainConfig.ammoCap)
return;
if(getIsReloading(stack))
@ -421,8 +424,10 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
if(!mainConfig.reloadSoundEnd)
world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F);
if(!world.isRemote)
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.RELOAD.ordinal()), (EntityPlayerMP) player);
if(!world.isRemote) {
AnimType reloadType = getMag(stack) == 0 ? AnimType.RELOAD_EMPTY : AnimType.RELOAD;
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(reloadType.ordinal()), (EntityPlayerMP) player);
}
setIsReloading(stack, true);
resetReloadCycle(player, stack);
@ -784,6 +789,10 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
@SideOnly(Side.CLIENT)
public BusAnimation getAnimation(ItemStack stack, AnimType type) {
GunConfiguration config = ((ItemGunBase) stack.getItem()).mainConfig;
if (!config.animationsLoaded && config.loadAnimations != null) {
config.loadAnimations.accept(null);
config.animationsLoaded = true;
}
return config.animations.get(type);
}
@ -825,7 +834,9 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
}
public static int getReloadDuration(EntityPlayer player, ItemStack stack) {
int cycle = ((ItemGunBase) stack.getItem()).mainConfig.reloadDuration;
GunConfiguration config = ((ItemGunBase) stack.getItem()).mainConfig;
int cycle = config.reloadDuration;
if (getMag(stack) == 0) cycle += config.emptyReloadAdditionalDuration;
if(isTrenchMaster(player)) return Math.max(1, cycle / 2);
return cycle;
}

View File

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

View File

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

View File

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

View File

@ -136,7 +136,6 @@ public class ClientProxy extends ServerProxy {
registerClientEventHandler(theInfoSystem);
AdvancedModelLoader.registerModelHandler(new HmfModelLoader());
ResourceManager.loadAnimatedModels();
registerTileEntitySpecialRenderer();
registerItemRenderer();
@ -543,7 +542,7 @@ public class ClientProxy extends ServerProxy {
MinecraftForgeClient.registerItemRenderer(ModItems.gun_bio_revolver, new ItemRenderBioRevolver());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_deagle, new ItemRenderWeaponObj());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_supershotgun, new ItemRenderWeaponShotty());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_ks23, new ItemRenderWeaponObj());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_ks23, new ItemRenderWeaponKS23());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_flamer, new ItemRenderWeaponObj());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_flechette, new ItemRenderWeaponObj());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_quadro, new ItemRenderWeaponQuadro());
@ -1740,9 +1739,9 @@ public class ClientProxy extends ServerProxy {
BusAnimation animation = new BusAnimation()
.addBus("GUARD_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(90, 0, 1, 0))
.addKeyframe(new BusAnimationKeyframe(90, 0, 1, 800))
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 50)));
.addKeyframePosition(90, 0, 1, 0)
.addKeyframePosition(90, 0, 1, 800)
.addKeyframePosition(0, 0, 1, 50));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
}
@ -1756,13 +1755,13 @@ public class ClientProxy extends ServerProxy {
BusAnimation animation = new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(90 - offset, 90 - offset, 35, 75))
.addKeyframe(new BusAnimationKeyframe(90 + offset, 90 - offset, -45, 150))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)))
.addKeyframePosition(90 - offset, 90 - offset, 35, 75)
.addKeyframePosition(90 + offset, 90 - offset, -45, 150)
.addKeyframePosition(0, 0, 0, 500))
.addBus("SWING_TRANS", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(-3, 0, 0, 75))
.addKeyframe(new BusAnimationKeyframe(8, 0, 0, 150))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)));
.addKeyframePosition(-3, 0, 0, 75)
.addKeyframePosition(8, 0, 0, 150)
.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));
@ -1781,13 +1780,13 @@ public class ClientProxy extends ServerProxy {
BusAnimation animation = new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 90, forward))
.addKeyframe(new BusAnimationKeyframe(45, 0, 90, sideways))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, retire)))
.addKeyframePosition(0, 0, 90, forward)
.addKeyframePosition(45, 0, 90, sideways)
.addKeyframePosition(0, 0, 0, retire))
.addBus("SWING_TRANS", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 3, forward))
.addKeyframe(new BusAnimationKeyframe(2, 0, 2, sideways))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, retire)));
.addKeyframePosition(0, 0, 3, forward)
.addKeyframePosition(2, 0, 2, sideways)
.addKeyframePosition(0, 0, 0, retire));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
@ -1801,15 +1800,15 @@ public class ClientProxy extends ServerProxy {
BusAnimation animation = new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(rot[0], rot[1], rot[2], 0))
.addKeyframe(new BusAnimationKeyframe(0, 0, 90, forward))
.addKeyframe(new BusAnimationKeyframe(45, 0, 90, sideways))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, retire)))
.addKeyframePosition(rot[0], rot[1], rot[2], 0)
.addKeyframePosition(0, 0, 90, forward)
.addKeyframePosition(45, 0, 90, sideways)
.addKeyframePosition(0, 0, 0, retire))
.addBus("SWING_TRANS", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(trans[0], trans[1], trans[2], 0))
.addKeyframe(new BusAnimationKeyframe(0, 0, 3, forward))
.addKeyframe(new BusAnimationKeyframe(2, 0, 2, sideways))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, retire)));
.addKeyframePosition(trans[0], trans[1], trans[2], 0)
.addKeyframePosition(0, 0, 3, forward)
.addKeyframePosition(2, 0, 2, sideways)
.addKeyframePosition(0, 0, 0, retire));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
}

View File

@ -321,6 +321,9 @@ public class ModEventHandlerClient {
if(animation == null)
continue;
if(animation.holdLastFrame)
continue;
long time = System.currentTimeMillis() - animation.startMillis;

View File

@ -1,9 +1,13 @@
package com.hbm.main;
import java.util.HashMap;
import com.hbm.animloader.AnimatedModel;
import com.hbm.animloader.Animation;
import com.hbm.animloader.ColladaLoader;
import com.hbm.lib.RefStrings;
import com.hbm.render.anim.AnimationLoader;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.loader.HFRWavefrontObject;
import com.hbm.render.loader.WavefrontObjDisplayList;
@ -318,12 +322,12 @@ public class ResourceManager {
public static final ResourceLocation sliding_blast_door_variant1_tex = new ResourceLocation(RefStrings.MODID, "textures/models/doors/sliding_blast_door_variant1.png");
public static final ResourceLocation sliding_blast_door_variant2_tex = new ResourceLocation(RefStrings.MODID, "textures/models/doors/sliding_blast_door_variant2.png");
public static AnimatedModel sliding_blast_door;
public static Animation sliding_blast_door_anim;
public static AnimatedModel sliding_blast_door = ColladaLoader.load(new ResourceLocation(RefStrings.MODID, "models/doors/sliding_blast_door.dae"));
public static Animation sliding_blast_door_anim = ColladaLoader.loadAnim(1200, new ResourceLocation(RefStrings.MODID, "models/doors/sliding_blast_door.dae"));
//Doors
public static AnimatedModel transition_seal;
public static Animation transition_seal_anim;
public static AnimatedModel transition_seal = ColladaLoader.load(new ResourceLocation(RefStrings.MODID, "models/doors/seal.dae"), true);
public static Animation transition_seal_anim = ColladaLoader.loadAnim(24040, new ResourceLocation(RefStrings.MODID, "models/doors/seal.dae"));
public static final WavefrontObjDisplayList fire_door = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/doors/fire_door.obj")).asDisplayList();
//Secure Access Door
@ -830,7 +834,6 @@ public class ResourceManager {
public static final IModelCustom bio_revolver = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/bio_revolver.obj"));
public static final IModelCustom chemthrower = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/chemthrower.obj")).asDisplayList();
public static final IModelCustom novac = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/novac.obj"));
public static final IModelCustom novac_scoped = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/novac_scoped.obj"));
public static final IModelCustom m2 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/m2_browning.obj")).asDisplayList(); //large fella should be a display list
public static final IModelCustom lunatic_sniper = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/lunatic_sniper.obj")).asDisplayList();
public static final IModelCustom tau = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/tau.obj"));
@ -840,6 +843,11 @@ public class ResourceManager {
public static final IModelCustom uac_pistol = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/UAC pistol.obj")).asDisplayList();
public static final IModelCustom congolake = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/congolake.obj")).asDisplayList();
public static final IModelCustom lilmac = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/lilmac.obj")).asDisplayList();
public static final HashMap<String, BusAnimation> python_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/python.json"));
public static final HashMap<String, BusAnimation> cursed_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/cursed.json"));
public static final HashMap<String, BusAnimation> novac_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/novac.json"));
public static final HashMap<String, BusAnimation> ks23_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/ks23.json"));
public static final IModelCustom lance = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/lance.obj"));
@ -1508,11 +1516,4 @@ public class ResourceManager {
public static final IModelCustom deb_zirnox_exchanger = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/zirnox/deb_exchanger.obj"));
public static final IModelCustom deb_zirnox_shrapnel = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/zirnox/deb_shrapnel.obj"));
public static void loadAnimatedModels(){
transition_seal = ColladaLoader.load(new ResourceLocation(RefStrings.MODID, "models/doors/seal.dae"), true);
transition_seal_anim = ColladaLoader.loadAnim(24040, new ResourceLocation(RefStrings.MODID, "models/doors/seal.dae"));
sliding_blast_door = ColladaLoader.load(new ResourceLocation(RefStrings.MODID, "models/doors/sliding_blast_door.dae"));
sliding_blast_door_anim = ColladaLoader.loadAnim(1200, new ResourceLocation(RefStrings.MODID, "models/doors/sliding_blast_door.dae"));
}
}

View File

@ -58,10 +58,18 @@ public class GunAnimationPacket implements IMessage {
return null;
AnimType type = AnimType.values()[m.type];
BusAnimation animation = ((ItemGunBase) stack.getItem()).getAnimation(stack, type);
ItemGunBase base = (ItemGunBase) stack.getItem();
BusAnimation animation = base.getAnimation(stack, type);
// Fallback to regular reload if no empty reload animation
if(animation == null && type == AnimType.RELOAD_EMPTY) {
animation = base.getAnimation(stack, AnimType.RELOAD);
}
if(animation != null) {
HbmAnimations.hotbar[slot] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
boolean isReloadAnimation = type == AnimType.RELOAD || type == AnimType.RELOAD_CYCLE || type == AnimType.RELOAD_EMPTY;
HbmAnimations.hotbar[slot] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, isReloadAnimation && base.mainConfig.reloadAnimationsSequential);
}
} catch(Exception x) { }

View File

@ -0,0 +1,149 @@
package com.hbm.render.anim;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonElement;
import com.google.gson.JsonArray;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import com.hbm.render.anim.BusAnimationSequence.Dimension;
public class AnimationLoader {
// The collada loader is great, but is not so backwards compatible and spews keyframes rather than doing interpolation
// Yeah - more animation loading is not so great, but 3mb for a single door opening is maybe overkill on a 50mb mod
// and even though the format supports multiple animations, no fucking animation software will actually export multiple animations,
// (even though blender even has a fucking toggle for it, but it doesn't _do_ anything)
// This instead just loads transformation data from a JSON file, turning it into a set of BusAnimations
// See ntm-animator.blend for a JSON format creation script
// "How do I make animations?"
// See ntm-animator.blend, it has the Colt/Python already setup and animated as an example, it'll generate JSON data that this can load
public static final Gson gson = new Gson();
public static HashMap<String, BusAnimation> load(ResourceLocation file) {
HashMap<String, BusAnimation> animations = new HashMap<String, BusAnimation>();
InputStream in;
try {
in = Minecraft.getMinecraft().getResourceManager().getResource(file).getInputStream();
} catch (IOException ex) {
return null;
}
InputStreamReader reader = new InputStreamReader(in);
JsonObject json = gson.fromJson(reader, JsonObject.class);
// Load our model offsets, we'll place these into all the sequences that share the name of the offset
// The offsets are only required when sequences are played for an object, which is why we don't globally offset! The obj rendering handles the non-animated case fine
// Effectively, this removes double translation AND ensures that rotations occur around the individual object origin, rather than the weapon origin
HashMap<String, double[]> offsets = new HashMap<String, double[]>();
for (Map.Entry<String, JsonElement> root : json.getAsJsonObject("offset").entrySet()) {
double[] offset = new double[3];
for (int i = 0; i < 3; i++) {
offset[i] = root.getValue().getAsJsonArray().get(i).getAsDouble();
}
offsets.put(root.getKey(), offset);
}
// Top level parsing, this is for the animation name as set in Blender
for (Map.Entry<String, JsonElement> root : json.getAsJsonObject("anim").entrySet()) {
BusAnimation animation = new BusAnimation();
// Loading the buses for this animation
JsonObject entryObject = root.getValue().getAsJsonObject();
for (Map.Entry<String, JsonElement> model : entryObject.entrySet()) {
String modelName = model.getKey();
double[] offset = new double[3];
if (offsets.containsKey(modelName)) offset = offsets.get(modelName);
animation.addBus(modelName, loadSequence(model.getValue().getAsJsonObject(), offset));
}
animations.put(root.getKey(), animation);
}
return animations;
}
private static BusAnimationSequence loadSequence(JsonObject json, double[] offset) {
BusAnimationSequence sequence = new BusAnimationSequence();
// Location fcurves
if (json.has("location")) {
JsonObject location = json.getAsJsonObject("location");
if (location.has("x")) {
addToSequence(sequence, Dimension.TX, location.getAsJsonArray("x"));
}
if (location.has("y")) {
addToSequence(sequence, Dimension.TY, location.getAsJsonArray("y"));
}
if (location.has("z")) {
addToSequence(sequence, Dimension.TZ, location.getAsJsonArray("z"));
}
}
// Rotation fcurves, only euler at the moment
if (json.has("rotation_euler")) {
JsonObject rotation = json.getAsJsonObject("rotation_euler");
if (rotation.has("x")) {
addToSequence(sequence, Dimension.RX, rotation.getAsJsonArray("x"));
}
if (rotation.has("y")) {
addToSequence(sequence, Dimension.RY, rotation.getAsJsonArray("y"));
}
if (rotation.has("z")) {
addToSequence(sequence, Dimension.RZ, rotation.getAsJsonArray("z"));
}
}
// Scale fcurves
if (json.has("scale")) {
JsonObject scale = json.getAsJsonObject("scale");
if (scale.has("x")) {
addToSequence(sequence, Dimension.SX, scale.getAsJsonArray("x"));
}
if (scale.has("y")) {
addToSequence(sequence, Dimension.SY, scale.getAsJsonArray("y"));
}
if (scale.has("z")) {
addToSequence(sequence, Dimension.SZ, scale.getAsJsonArray("z"));
}
}
sequence.offset = offset;
return sequence;
}
private static void addToSequence(BusAnimationSequence sequence, Dimension dimension, JsonArray array) {
for (JsonElement element : array) {
sequence.addKeyframe(dimension, loadKeyframe(element));
}
}
private static BusAnimationKeyframe loadKeyframe(JsonElement element) {
JsonArray array = element.getAsJsonArray();
double value = array.get(0).getAsDouble();
int duration = array.get(1).getAsInt();
return new BusAnimationKeyframe(value, duration);
}
}

View File

@ -10,7 +10,7 @@ import java.util.Map.Entry;
public class BusAnimation {
//"buses" with one S since it's not a vehicle
private final HashMap<String, BusAnimationSequence> animationBuses= new HashMap();
private final HashMap<String, BusAnimationSequence> animationBuses = new HashMap<String, BusAnimationSequence>();
//multiples buses exist simultaneously and start with 0.
//a bus has one authority, i.e. the translation of a single part of a model or the rotation of the entire thing.
//imagine the busses being film strips that hang from the ceiling, with the tape player

View File

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

View File

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

View File

@ -4,6 +4,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
public class HbmAnimations {
//in flans mod and afaik also MW, there's an issue that there is only one
@ -16,13 +18,19 @@ public class HbmAnimations {
public static final Animation[] hotbar = new Animation[9];
public static enum AnimType {
RELOAD, //animation for every reload cycle
CYCLE, //animation for every firing cycle
ALT_CYCLE, //animation for alt fire cycles
SPINUP, //animation for actionstart
SPINDOWN, //animation for actionend
EQUIP //animation for drawing the weapon
RELOAD, //animation for reloading the weapon
RELOAD_EMPTY, //animation for reloading from empty
RELOAD_CYCLE, //animation that plays for every individual round (for shotguns and similar single round loading weapons)
RELOAD_END, //animation for transitioning from our RELOAD_CYCLE to idle
CYCLE, //animation for every firing cycle
ALT_CYCLE, //animation for alt fire cycles
SPINUP, //animation for actionstart
SPINDOWN, //animation for actionend
EQUIP //animation for drawing the weapon
}
// A NOTE ON SHOTGUN STYLE RELOADS
// Make sure the RELOAD and RELOAD_EMPTY adds shells, not just RELOAD_CYCLE, they all proc once for each loaded shell
public static class Animation {
@ -33,12 +41,21 @@ public class HbmAnimations {
public long startMillis;
//the animation bus
public BusAnimation animation;
// If set, don't cancel this animation when the timer ends, instead wait for the next to start
public boolean holdLastFrame = false;
public Animation(String key, long startMillis, BusAnimation animation) {
this.key = key;
this.startMillis = startMillis;
this.animation = animation;
}
public Animation(String key, long startMillis, BusAnimation animation, boolean holdLastFrame) {
this.key = key;
this.startMillis = startMillis;
this.animation = animation;
this.holdLastFrame = holdLastFrame;
}
}
public static Animation getRelevantAnim() {
@ -82,8 +99,24 @@ public class HbmAnimations {
return trans;
}
}
return new double[] {
0, 0, 0, // position
0, 0, 0, // rotation
1, 1, 1, // scale
0, 0, 0 // offset
};
}
public static void applyRelevantTransformation(String bus) {
double[] transform = getRelevantTransformation(bus);
return new double[] {0, 0, 0};
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.glTranslated(-transform[9], -transform[10], -transform[11]);
GL11.glScaled(transform[6], transform[7], transform[8]);
}
}

View File

@ -3,6 +3,7 @@ package com.hbm.render.item.weapon;
import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
@ -55,8 +56,26 @@ public class ItemRenderWeaponFFColt implements IItemRenderer {
GL11.glScaled(s0, s0, s0);
GL11.glRotated(100, 0, -1, 0);
GL11.glRotated(25, 1, 0, 0);
HbmAnimations.applyRelevantTransformation("Body");
Minecraft.getMinecraft().renderEngine.bindTexture(main);
ResourceManager.ff_python.renderPart("Body");
GL11.glPushMatrix();
HbmAnimations.applyRelevantTransformation("Cylinder");
ResourceManager.ff_python.renderPart("Cylinder");
GL11.glPopMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(grip);
ResourceManager.ff_python.renderPart("Grip");
HbmAnimations.applyRelevantTransformation("Hammer");
Minecraft.getMinecraft().renderEngine.bindTexture(hammer);
ResourceManager.ff_python.renderPart("Hammer");
break;
GL11.glPopMatrix();
return;
case EQUIPPED:

View File

@ -3,6 +3,7 @@ package com.hbm.render.item.weapon;
import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
@ -39,30 +40,52 @@ public class ItemRenderWeaponFFCursed implements IItemRenderer {
case EQUIPPED_FIRST_PERSON:
double s0 = 0.25D;
GL11.glTranslated(0.75, 0.25, 0);
double s0 = 1.5D;
GL11.glTranslated(0.75, 0.5, 0);
GL11.glScaled(s0, s0, s0);
GL11.glRotated(170, 0, 1, 0);
GL11.glRotated(25, 0, 0, -1);
GL11.glRotated(100, 0, -1, 0);
GL11.glRotated(20, 1, 0, 0);
GL11.glShadeModel(GL11.GL_SMOOTH);
HbmAnimations.applyRelevantTransformation("Body");
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.ff_cursed);
ResourceManager.cursed_revolver.renderPart("Body");
ResourceManager.cursed_revolver.renderPart("Barrel");
ResourceManager.cursed_revolver.renderPart("Grip");
break;
GL11.glPushMatrix();
HbmAnimations.applyRelevantTransformation("Slide");
ResourceManager.cursed_revolver.renderPart("Slide");
GL11.glPopMatrix();
GL11.glPushMatrix();
HbmAnimations.applyRelevantTransformation("Magazine");
ResourceManager.cursed_revolver.renderPart("Magazine");
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
return;
case EQUIPPED:
double scale = 0.25D;
GL11.glRotated(105, 0, 1, 0);
double scale = 1.5D;
GL11.glRotated(195, 0, 1, 0);
GL11.glRotated(-10, 0, 0, 1);
GL11.glRotated(-10, 1, 0, 0);
GL11.glRotated(10, 0, 0, 1);
GL11.glTranslated(0.2, 0.05, 0.45);
GL11.glTranslated(-0.5, 0.1, -0.25);
GL11.glScaled(scale, scale, scale);
break;
case ENTITY:
double s1 = 0.125D;
double s1 = 1D;
GL11.glScaled(s1, s1, s1);
GL11.glTranslated(1, 0, 0);
GL11.glRotated(90, 0, 1, 0);
break;
@ -70,10 +93,10 @@ public class ItemRenderWeaponFFCursed implements IItemRenderer {
GL11.glEnable(GL11.GL_LIGHTING);
double s = 2.75D;
double s = 17D;
GL11.glTranslated(10, 11.5, 0);
GL11.glRotated(-135, 0, 0, 1);
GL11.glRotated(180, 0, 1, 0);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(s, s, -s);
break;

View File

@ -0,0 +1,144 @@
package com.hbm.render.item.weapon;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing;
import com.hbm.render.anim.HbmAnimations;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
public class ItemRenderWeaponKS23 implements IItemRenderer {
public ItemRenderWeaponKS23() { }
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
switch(type) {
case EQUIPPED:
case EQUIPPED_FIRST_PERSON:
case ENTITY:
case INVENTORY:
return true;
default: return false;
}
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return type == ItemRenderType.ENTITY && (helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING);
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_CULL_FACE);
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.ks23_tex);
switch(type) {
case EQUIPPED_FIRST_PERSON:
GL11.glTranslatef(1.0F, 0.5F, -0.25F);
GL11.glRotatef(25F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-100, 0.0F, 1.0F, 0.0F);
GL11.glScaled(0.75, 0.75, 0.75);
if(player.isSneaking()) {
GL11.glRotatef(4.5F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-2F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.9F, 0.2F, 0.325F);
}
HbmAnimations.applyRelevantTransformation("Body");
GL11.glShadeModel(GL11.GL_SMOOTH);
ResourceManager.ks23.renderPart("Body");
ResourceManager.ks23.renderPart("Trigger");
GL11.glPushMatrix();
HbmAnimations.applyRelevantTransformation("Bolt");
ResourceManager.ks23.renderPart("Bolt");
GL11.glPopMatrix();
GL11.glPushMatrix();
HbmAnimations.applyRelevantTransformation("Guard");
ResourceManager.ks23.renderPart("Guard");
GL11.glPopMatrix();
GL11.glPushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.casings_tex);
HbmAnimations.applyRelevantTransformation("Shell");
// TODO: Fetch the correct colors to render on the shells
Color shellColor = new Color(SpentCasing.COLOR_CASE_4GA);
GL11.glColor3f(shellColor.getRed() / 255F, shellColor.getGreen() / 255F, shellColor.getBlue() / 255F);
ResourceManager.ks23.renderPart("Shell");
Color shellForeColor = new Color(0xFFD800);
GL11.glColor3f(shellForeColor.getRed() / 255F, shellForeColor.getGreen() / 255F, shellForeColor.getBlue() / 255F);
ResourceManager.ks23.renderPart("ShellFore");
GL11.glColor3f(1F, 1F, 1F);
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
return;
case EQUIPPED:
GL11.glRotatef(20F, 1.0F, 0.0F, 1.0F);
GL11.glRotatef(-170F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, 0.0F, -0.9F);
GL11.glScaled(0.5, 0.5, 0.5);
break;
case ENTITY:
GL11.glTranslatef(0.3F, 0.2F, 0.0F);
GL11.glScaled(0.5, 0.5, 0.5);
break;
case INVENTORY:
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glTranslatef(7F, 8F, 0.0F);
GL11.glScaled(4, 4, -4);
GL11.glRotatef(-90, 0, 1, 0);
GL11.glRotatef(-135F, 1.0F, 0.0F, 0.0F);
break;
default: break;
}
GL11.glShadeModel(GL11.GL_SMOOTH);
ResourceManager.ks23.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
}
}

View File

@ -5,6 +5,7 @@ import org.lwjgl.opengl.GL11;
import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
@ -58,8 +59,37 @@ public class ItemRenderWeaponNovac implements IItemRenderer {
GL11.glRotatef(180, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.0F, 0.0F, -1.25F);
GL11.glScaled(s0, s0, s0);
GL11.glShadeModel(GL11.GL_SMOOTH);
HbmAnimations.applyRelevantTransformation("Body");
ResourceManager.novac.renderPart("Body");
GL11.glPushMatrix();
HbmAnimations.applyRelevantTransformation("Cylinder");
ResourceManager.novac.renderPart("Cylinder");
GL11.glPopMatrix();
GL11.glPushMatrix();
HbmAnimations.applyRelevantTransformation("Hammer");
ResourceManager.novac.renderPart("Hammer");
GL11.glPopMatrix();
GL11.glPushMatrix();
HbmAnimations.applyRelevantTransformation("Trigger");
ResourceManager.novac.renderPart("Trigger");
GL11.glPopMatrix();
if (item.getItem() == ModItems.gun_revolver_pip) {
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.novac_scope_tex);
ResourceManager.novac.renderPart("Scope");
}
GL11.glShadeModel(GL11.GL_FLAT);
break;
GL11.glPopMatrix();
return;
case EQUIPPED:
@ -97,15 +127,13 @@ public class ItemRenderWeaponNovac implements IItemRenderer {
}
GL11.glShadeModel(GL11.GL_SMOOTH);
ResourceManager.novac.renderAllExcept("Scope");
if(item.getItem() == ModItems.gun_revolver_pip) {
ResourceManager.novac_scoped.renderPart("Gun");
ResourceManager.novac_scoped.renderPart("Hammer");
ResourceManager.novac_scoped.renderPart("Cylinder");
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.novac_scope_tex);
ResourceManager.novac_scoped.renderPart("Scope");
} else {
ResourceManager.novac.renderAll();
ResourceManager.novac.renderPart("Scope");
}
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();

View File

@ -23,7 +23,7 @@ public class ItemRenderWeaponObj implements IItemRenderer {
case ENTITY:
return true;
case INVENTORY:
return item.getItem() == ModItems.gun_ks23 || item.getItem() == ModItems.gun_hk69
return item.getItem() == ModItems.gun_hk69
|| item.getItem() == ModItems.gun_flamer || item.getItem() == ModItems.gun_deagle
|| item.getItem() == ModItems.gun_flechette || item.getItem() == ModItems.gun_quadro;
default: return false;
@ -50,9 +50,6 @@ public class ItemRenderWeaponObj implements IItemRenderer {
if(item.getItem() == ModItems.gun_deagle)
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.universal_bright);
if(item.getItem() == ModItems.gun_ks23)
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.ks23_tex);
if(item.getItem() == ModItems.gun_flamer)
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.flamer_tex);
@ -90,19 +87,6 @@ public class ItemRenderWeaponObj implements IItemRenderer {
}
}
if(item.getItem() == ModItems.gun_ks23) {
GL11.glTranslatef(1.0F, 0.5F, -0.25F);
GL11.glRotatef(25F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-10F, 0.0F, 1.0F, 0.0F);
GL11.glScaled(0.75, 0.75, 0.75);
if(player.isSneaking()) {
GL11.glRotatef(4.5F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-2.5F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.3F, 0.2F, -0.875F);
}
}
if(item.getItem() == ModItems.gun_flamer) {
GL11.glTranslatef(1.0F, 0.0F, -0.15F);
GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
@ -169,13 +153,6 @@ public class ItemRenderWeaponObj implements IItemRenderer {
GL11.glScaled(0.15, 0.15, 0.15);
}
if(item.getItem() == ModItems.gun_ks23) {
GL11.glRotatef(20F, 1.0F, 0.0F, 1.0F);
GL11.glRotatef(-80F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.9F, 0.0F, -0.5F);
GL11.glScaled(0.5, 0.5, 0.5);
}
if(item.getItem() == ModItems.gun_flamer) {
GL11.glRotatef(20F, 1.0F, 0.0F, 1.0F);
GL11.glRotatef(10F, 0.0F, 1.0F, 0.0F);
@ -213,11 +190,6 @@ public class ItemRenderWeaponObj implements IItemRenderer {
GL11.glScaled(0.25, 0.25, 0.25);
}
if(item.getItem() == ModItems.gun_ks23) {
GL11.glTranslatef(0.3F, 0.2F, 0.0F);
GL11.glScaled(0.5, 0.5, 0.5);
}
if(item.getItem() == ModItems.gun_flamer) {
GL11.glTranslatef(0.25F, 0.2F, 0.0F);
GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
@ -257,12 +229,6 @@ public class ItemRenderWeaponObj implements IItemRenderer {
GL11.glRotatef(-45F, 1.0F, 0.0F, 0.0F);
}
if(item.getItem() == ModItems.gun_ks23) {
GL11.glTranslatef(7F, 8F, 0.0F);
GL11.glScaled(4, 4, -4);
GL11.glRotatef(-135F, 0.0F, 0.0F, 1.0F);
}
if(item.getItem() == ModItems.gun_flamer) {
GL11.glScaled(2.0, 2.0, -2.0);
GL11.glTranslatef(4.0F, 5.0F, 0.0F);
@ -303,12 +269,6 @@ public class ItemRenderWeaponObj implements IItemRenderer {
GL11.glShadeModel(GL11.GL_FLAT);
}
if(item.getItem() == ModItems.gun_ks23) {
GL11.glShadeModel(GL11.GL_SMOOTH);
ResourceManager.ks23.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
}
if(item.getItem() == ModItems.gun_flamer) {
GL11.glShadeModel(GL11.GL_SMOOTH);
ResourceManager.flamer.renderAll();

View File

@ -44,24 +44,17 @@ public class ItemRenderWeaponSpas12 implements IItemRenderer {
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;
GL11.glRotated(25, 0, 0, 1);
GL11.glTranslated(0, -0.8, 0.1);
GL11.glRotated(80, 0, 1, 0);
GL11.glScaled(s0, s0, s0);
int m = 2;
GL11.glTranslated(recoilT[0]*m, recoilT[1]*m, recoilT[2]*m);
GL11.glRotated(2, recoilR[0]*m, recoilR[1]*m, recoilR[2]*m);
HbmAnimations.applyRelevantTransformation("SPAS_RECOIL");
ResourceManager.spas_12.renderPart("MainBody");
GL11.glTranslated(pump[0], pump[1], pump[2]);
HbmAnimations.applyRelevantTransformation("SPAS_PUMP");
ResourceManager.spas_12.renderPart("PumpGrip");

View File

@ -285,7 +285,7 @@ public class TileEntityDoorGeneric extends TileEntityLockableBase implements IAn
}
}
if((this.state == 3 && state == 1) || (this.state == 2 && state == 0)){ // Door finished any transition
if(state == 1 || state == 0){ // Door finished any transition
if(audio != null){
audio.stopSound();
audio = null;

View File

@ -0,0 +1 @@
{"anim": {"Fire": {"Body": {"location": {"z": [[-0.0, 0.0], [-0.0, 16.666666666666668], [0.1901400089263916, 50.0], [-0.0, 183.33333333333331]], "y": [[0.0, 0.0], [0.0, 16.666666666666668], [0.040800124406814575, 50.0], [0.0, 183.33333333333331]]}, "rotation_euler": {"x": [[0.0, 33.333333333333336], [38.989947046815615, 66.66666666666666], [0.0, 250.0]]}}, "Slide": {"location": {"z": [[-0.0, 0.0], [0.12989415228366852, 16.666666666666668], [0.12989415228366852, 50.0], [0.09892651438713074, 83.33333333333333], [-0.0, 83.33333333333334]]}}}, "Reload": {"Body": {"location": {"x": [[0.0, 0.0], [0.0, 100.0], [0.017018239945173264, 116.66666666666669], [-0.09787648171186447, 83.33333333333331], [-0.12292511016130447, 266.66666666666663], [-0.10135655850172043, 133.33333333333337], [-0.1491556018590927, 150.0], [-0.13177432119846344, 400.0], [0.0, 283.33333333333326]], "z": [[-0.0, 0.0], [0.08164123445749283, 100.0], [-0.08178003877401352, 116.66666666666669], [-0.09053938835859299, 83.33333333333331], [-0.05708351731300354, 233.33333333333337], [-0.03883926570415497, 166.66666666666663], [0.0013935839524492621, 150.0], [0.006992057431489229, 400.0], [-0.0, 283.33333333333326]], "y": [[0.0, 0.0], [0.18025973439216614, 100.0], [0.44325628876686096, 116.66666666666669], [0.21647267043590546, 83.33333333333331], [0.27539756894111633, 200.0], [0.10282676666975021, 200.0], [0.16902926564216614, 150.0], [-0.034092918038368225, 400.0], [0.0, 283.33333333333326]]}, "rotation_euler": {"x": [[0.0, 0.0], [14.347078728989414, 66.66666666666667], [22.703222659589517, 99.99999999999999], [15.15270124913971, 83.33333333333334], [1.8531396048511795, 100.0], [-18.417429219568255, 266.66666666666674], [-18.417429219568255, 99.99999999999989], [59.33201599901403, 200.0], [72.57186642203102, 216.66666666666663], [62.294070966562636, 116.66666666666674], [54.952785571147, 83.33333333333326], [0.0, 200.0]], "z": [[0.0, 0.0], [-10.592385430902713, 66.66666666666667], [-15.994342771878069, 99.99999999999999], [-11.103182835529408, 83.33333333333334], [-9.371659871492183, 100.0], [-9.698956560103671, 266.66666666666674], [-9.698956560103671, 149.9999999999999], [-50.8729052591287, 150.0], [-75.4402931564371, 216.66666666666663], [-52.8528848919616, 116.66666666666674], [-36.719021845907676, 83.33333333333326], [-0.0, 200.0]], "y": [[0.0, 0.0], [-3.154393948349805, 66.66666666666667], [-4.726022183917031, 99.99999999999999], [-3.3394954899517355, 83.33333333333334], [-2.877424441420499, 100.0], [-5.679812424619238, 266.66666666666674], [-5.679812424619238, 183.33333333333326], [-0.6765985391814631, 116.66666666666663], [21.457408107810238, 216.66666666666663], [34.27835619884117, 116.66666666666674], [43.4361748002513, 83.33333333333326], [0.0, 200.0]]}}, "Magazine": {"location": {"z": [[-0.0, 0.0], [-0.0, 300.0], [0.14596298336982727, 183.33333333333331], [0.41417545080184937, 249.99999999999994], [0.11441206932067871, 200.0000000000001], [-0.0, 133.33333333333337]], "y": [[0.0, 0.0], [0.0, 300.0], [-0.6360859274864197, 183.33333333333331], [-0.6360859274864197, 249.99999999999994], [-0.4159921109676361, 200.0000000000001], [0.0, 133.33333333333337]]}}, "Slide": {"location": {"z": [[-0.0, 0.0], [0.13051199913024902, 16.666666666666668], [0.13051199913024902, 1133.3333333333333], [0.0854932963848114, 66.66666666666652], [-0.0, 50.0]]}}}}, "offset": {}}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"anim": {"Fire": {"Body": {"rotation_euler": {"x": [[0.0, 0.0], [29.145301697941925, 66.66666666666667], [0.0, 566.6666666666666]]}, "location": {"z": [[-0.0, 0.0], [0.7235583066940308, 33.333333333333336], [-0.0, 599.9999999999999]], "y": [[0.0, 0.0], [0.7866886854171753, 33.333333333333336], [0.0, 599.9999999999999]]}}, "Hammer": {"rotation_euler": {"x": [[0.0, 0.0], [-42.84400081430579, 16.666666666666668], [-42.84400081430579, 250.00000000000003], [0.0, 200.0]]}, "location": {"x": [[0.0, 0.0]], "z": [[1.1140995025634766, 0.0]], "y": [[0.48292604088783264, 0.0]]}}}, "Reload": {"Body": {"location": {"x": [[0.0, 0.0], [0.04879806935787201, 166.66666666666666], [-0.1566363126039505, 133.33333333333334], [0.0, 166.66666666666669]], "z": [[-0.0, 0.0], [-0.7191624641418457, 166.66666666666666], [-1.058491826057434, 133.33333333333334], [-0.0, 166.66666666666669]], "y": [[0.0, 0.0], [0.7507638931274414, 166.66666666666666], [0.9907249212265015, 133.33333333333334], [0.0, 166.66666666666669]]}, "rotation_euler": {"x": [[0.0, 0.0], [-19.391663497116777, 166.66666666666666], [45.102665825653546, 133.33333333333334], [0.0, 166.66666666666669]], "z": [[-0.0, 0.0], [0.5174686318159474, 166.66666666666666], [3.009666081818643, 133.33333333333334], [-0.0, 166.66666666666669]], "y": [[-0.0, 0.0], [1.4431158784559095, 166.66666666666666], [-0.8437833740125396, 133.33333333333334], [0.0, 166.66666666666669]]}}}}, "offset": {"Cylinder": [3.725290298461914e-09, 0.5323800444602966, 0.4562000334262848], "Hammer": [0.0, 0.48292604088783264, 1.1140995025634766], "Trigger": [0.0, 0.12013805657625198, 0.7557680010795593]}}

View File

@ -0,0 +1 @@
{"anim": {"Fire": {"Body": {"location": {"z": [[-0.0, 0.0], [0.1901400089263916, 50.0], [-0.0, 283.3333333333333]], "y": [[0.0, 0.0], [0.22623062133789062, 50.0], [0.0, 283.3333333333333]]}, "rotation_euler": {"x": [[0.0, 16.666666666666668], [50.512076610560676, 66.66666666666666], [0.0, 250.0]]}}, "Hammer": {"rotation_euler": {"x": [[0.0, 0.0], [-44.61753114928588, 16.666666666666668], [-44.61753114928588, 183.33333333333334], [0.0, 300.0]]}, "location": {"x": [[0.00012800097465515137, 0.0]], "z": [[0.1478099822998047, 0.0]], "y": [[0.1151699647307396, 0.0]]}}}, "Reload": {"Body": {"location": {"x": [[0.0, 0.0], [0.1266033947467804, 216.66666666666669], [-0.1256844699382782, 66.66666666666663], [-0.10699314624071121, 100.0], [-0.05540347099304199, 183.33333333333331], [-0.04984791576862335, 83.33333333333337], [-0.04814600944519043, 100.0], [-0.0495946928858757, 50.0], [-0.1901838481426239, 216.66666666666663], [-0.209717258810997, 366.66666666666663], [-0.2682616710662842, 83.33333333333326], [0.06351689994335175, 100.00000000000023], [0.059162016957998276, 83.33333333333326], [0.0, 199.99999999999977]], "z": [[-0.0, 0.0], [0.018239933997392654, 216.66666666666669], [-0.003715081140398979, 66.66666666666663], [0.003378540277481079, 100.0], [0.06673367321491241, 183.33333333333331], [0.13605912029743195, 83.33333333333337], [0.11836071312427521, 100.0], [0.13753235340118408, 50.0], [0.2322661280632019, 216.66666666666663], [0.20868675410747528, 366.66666666666663], [0.15863937139511108, 83.33333333333326], [0.2003980427980423, 100.00000000000023], [0.09448619186878204, 83.33333333333326], [-0.0, 199.99999999999977]], "y": [[0.0, 0.0], [0.04348362237215042, 216.66666666666669], [0.04043026641011238, 66.66666666666663], [0.0498494915664196, 100.0], [0.21255171298980713, 183.33333333333331], [0.027551360428333282, 83.33333333333337], [0.09703753143548965, 100.0], [0.024584002792835236, 50.0], [-0.3309659957885742, 216.66666666666663], [-0.3340303301811218, 366.66666666666663], [-0.1700890064239502, 83.33333333333326], [0.016301512718200684, 100.00000000000023], [-0.015913818031549454, 83.33333333333326], [0.0, 199.99999999999977]]}, "rotation_euler": {"x": [[0.0, 0.0], [3.3686347844983024, 150.0], [0.02222707974050119, 166.66666666666663], [4.537149524119608, 100.00000000000006], [61.414745582626026, 233.33333333333331], [52.280518454609116, 133.33333333333337], [-71.68136001842309, 199.9999999999999], [-67.29034068404862, 366.66666666666674], [-53.072130549224426, 116.66666666666652], [-7.130840436898373, 100.00000000000023], [-2.7997762896148553, 83.33333333333326], [0.0, 199.99999999999977]], "z": [[0.0, 0.0], [-17.712562234959403, 150.0], [13.30397138517142, 166.66666666666663], [5.758366003376731, 100.00000000000006], [5.603675025280636, 233.33333333333331], [6.040763589705493, 133.33333333333337], [-1.4811513876747122, 199.9999999999999], [-0.9937320130296772, 366.66666666666674], [5.75973417564485, 116.66666666666652], [-7.87355264592462, 100.00000000000023], [-5.935155631645579, 83.33333333333326], [-0.0, 199.99999999999977]], "y": [[0.0, 0.0], [-3.362418245136533, 150.0], [5.488280686800564, 166.66666666666663], [2.9251945710321565, 100.00000000000006], [-3.2122371128833507, 233.33333333333331], [-2.2836878362589266, 133.33333333333337], [6.285038902068653, 199.9999999999999], [6.379913644734715, 366.66666666666674], [24.273973215848397, 116.66666666666652], [-30.381999654726528, 100.00000000000023], [-9.056688259237983, 83.33333333333326], [0.0, 199.99999999999977]]}}, "Cylinder": {"location": {"x": [[-0.0010489225387573242, 0.0], [-0.0010489225387573242, 283.3333333333333], [-0.07956840097904205, 83.33333333333331], [-0.07956840097904205, 1200.0], [-0.0010489225387573242, 83.33333333333326]], "z": [[0.07426249980926514, 0.0], [0.07426249980926514, 283.3333333333333], [0.07129553705453873, 83.33333333333331], [0.07129553705453873, 1200.0], [0.07426249980926514, 83.33333333333326]], "y": [[0.10388392210006714, 0.0], [0.10388392210006714, 283.3333333333333], [0.07195358723402023, 83.33333333333331], [0.07195358723402023, 1200.0], [0.10388392210006714, 83.33333333333326]]}}}}, "offset": {"Cylinder": [-0.0010489225387573242, 0.10388392210006714, 0.07426249980926514], "Grip": [0.0, -1.8214237229585706e-08, -0.0], "Hammer": [0.00012800097465515137, 0.1151699647307396, 0.1478099822998047]}}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff