ball and powder torture

This commit is contained in:
Bob 2024-09-24 23:53:14 +02:00
parent 36a02151bc
commit 1d92bcbf13
20 changed files with 3510 additions and 3124 deletions

View File

@ -1610,6 +1610,10 @@ public class ModItems {
public static Item gun_debug;
public static Item ammo_debug;
public static Item gun_pepperbox;
public static Item ammo_standard;
public static Item crucible;
public static Item stick_dynamite;
@ -6994,6 +6998,9 @@ public class ModItems {
GameRegistry.registerItem(gun_debug, gun_debug.getUnlocalizedName());
GameRegistry.registerItem(ammo_debug, ammo_debug.getUnlocalizedName());
GameRegistry.registerItem(gun_pepperbox, gun_pepperbox.getUnlocalizedName());
GameRegistry.registerItem(ammo_standard, ammo_standard.getUnlocalizedName());
//Ammo
GameRegistry.registerItem(gun_b92_ammo, gun_b92_ammo.getUnlocalizedName());
GameRegistry.registerItem(gun_xvl1456_ammo, gun_xvl1456_ammo.getUnlocalizedName());

View File

@ -6,6 +6,8 @@ import java.util.function.BiConsumer;
import com.hbm.entity.projectile.EntityBulletBaseMK4;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.particle.SpentCasing;
import net.minecraft.item.Item;
@ -25,6 +27,7 @@ public class BulletConfig {
public int projectilesMax = 1;
public float damageMult = 1.0F;
public float armorPiercingPercent = 0.0F;
public float headshotMult = 1.0F;
public float ricochetAngle = 5F;
@ -43,12 +46,14 @@ public class BulletConfig {
}
public BulletConfig setItem(Item ammo) { this.ammo = new ComparableStack(ammo); return this; }
public BulletConfig setItem(EnumAmmo ammo) { this.ammo = new ComparableStack(ModItems.ammo_standard, 1, ammo.ordinal()); return this; }
public BulletConfig setReloadCount(int ammoReloadCount) { this.ammoReloadCount = ammoReloadCount; return this; }
public BulletConfig setVel(float velocity) { this.velocity = velocity; return this; }
public BulletConfig setSpread(float spread) { this.spread = spread; return this; }
public BulletConfig setWear(float wear) { this.wear = wear; return this; }
public BulletConfig setProjectiles(int min, int max) { this.projectilesMin = min; this.projectilesMax = max; return this; }
public BulletConfig setDamage(float damageMult) { this.damageMult = damageMult; return this; }
public BulletConfig setArmorPiercing(float armorPiercingPercent) { this.armorPiercingPercent = armorPiercingPercent; return this; }
public BulletConfig setHeadshot(float headshotMult) { this.headshotMult = headshotMult; return this; }
public BulletConfig setRicochetAngle(float angle) { this.ricochetAngle = angle; return this; }
public BulletConfig setRicochetCount(int count) { this.maxRicochetCount = count; return this; }

View File

@ -1,26 +1,20 @@
package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiConsumer;
import com.hbm.handler.CasingEjector;
import com.hbm.items.ItemEnumMulti;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.Crosshair;
import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class GunFactory {
@ -33,6 +27,7 @@ public class GunFactory {
/// AMMO ITEMS ///
ModItems.ammo_debug = new Item().setUnlocalizedName("ammo_debug").setTextureName(RefStrings.MODID + ":ammo_45");
ModItems.ammo_standard = new ItemEnumMulti(EnumAmmo.class, true, true).setUnlocalizedName("ammo_standard").setTextureName(RefStrings.MODID + ":ammo_standard");
/// BULLLET CFGS ///
ammo_debug = new BulletConfig().setItem(ModItems.ammo_debug).setSpread(0.01F).setRicochetAngle(45).setCasing(CASING44.clone().register("DEBUG0"));
@ -40,7 +35,7 @@ public class GunFactory {
/// GUNS ///
ModItems.gun_debug = new ItemGunBaseNT(new GunConfig()
.dura(600F).draw(15).inspect(23).crosshair(Crosshair.L_CLASSIC).hud(Lego.HUD_COMPONENT_DURABILITY, Lego.HUD_COMPONENT_AMMO).smoke(true).orchestra(DEBUG_ORCHESTRA)
.dura(600F).draw(15).inspect(23).crosshair(Crosshair.L_CLASSIC).hud(Lego.HUD_COMPONENT_DURABILITY, Lego.HUD_COMPONENT_AMMO).smoke(true).orchestra(Orchestras.DEBUG_ORCHESTRA)
.rec(new Receiver(0)
.dmg(10F).delay(14).reload(46).sound("hbm:weapon.44Shoot", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 12).addConfigs(ammo_debug, ammo_debug_buckshot))
@ -50,40 +45,16 @@ public class GunFactory {
.decider(GunStateDecider.LAMBDA_STANDARD_DECIDER)
.anim(Lego.LAMBDA_DEBUG_ANIMS)
).setUnlocalizedName("gun_debug").setTextureName(RefStrings.MODID + ":gun_darter");
XFactoryBlackPowder.init();
/// PROXY BULLSHIT ///
MainRegistry.proxy.registerGunCfg();
}
public static BiConsumer<ItemStack, LambdaContext> DEBUG_ORCHESTRA = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack);
int timer = ItemGunBaseNT.getAnimTimer(stack);
if(type == AnimType.RELOAD) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
if(timer == 10) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
if(timer == 34) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
if(timer == 40) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
if(timer == 20) {
Receiver rec = ctx.config.getReceivers(stack)[0];
IMagazine mag = rec.getMagazine(stack);
CasingEjector ejector = rec.getEjector(stack);
BulletConfig bullet = (BulletConfig) mag.getType(stack);
for(int i = 0; i < mag.getCapacity(stack); i++) ItemGunBaseNT.trySpawnCasing(player, ejector, bullet, stack);
}
}
if(type == AnimType.CYCLE) {
if(timer == 11) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 11) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
}
if(type == AnimType.INSPECT) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
if(timer == 16) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
}
};
public static enum EnumAmmo {
STONE,
STONE_AP,
STONE_SHOT,
}
}

View File

@ -7,12 +7,20 @@ import java.util.function.BiConsumer;
import org.lwjgl.opengl.GL11;
import com.hbm.entity.projectile.EntityBulletBaseMK4;
import com.hbm.items.ModItems;
import com.hbm.render.item.weapon.sedna.ItemRenderDebug;
import com.hbm.render.item.weapon.sedna.ItemRenderPepperbox;
import net.minecraft.client.renderer.Tessellator;
import net.minecraftforge.client.MinecraftForgeClient;
public class GunFactoryClient {
public static void init() {
//GUNS
MinecraftForgeClient.registerItemRenderer(ModItems.gun_debug, new ItemRenderDebug());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_pepperbox, new ItemRenderPepperbox());
//PROJECTILES
ammo_debug.setRenderer(RENDER_STANDARD_BULLET);
ammo_debug_buckshot.setRenderer(RENDER_STANDARD_BULLET);
}

View File

@ -0,0 +1,70 @@
package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiConsumer;
import com.hbm.handler.CasingEjector;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> DEBUG_ORCHESTRA = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack);
int timer = ItemGunBaseNT.getAnimTimer(stack);
if(type == AnimType.RELOAD) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
if(timer == 10) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
if(timer == 34) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
if(timer == 40) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
if(timer == 20) {
Receiver rec = ctx.config.getReceivers(stack)[0];
IMagazine mag = rec.getMagazine(stack);
CasingEjector ejector = rec.getEjector(stack);
BulletConfig bullet = (BulletConfig) mag.getType(stack);
for(int i = 0; i < mag.getCapacity(stack); i++) ItemGunBaseNT.trySpawnCasing(player, ejector, bullet, stack);
}
}
if(type == AnimType.CYCLE) {
if(timer == 11) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 11) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
}
if(type == AnimType.INSPECT) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
if(timer == 16) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_PEPPERBOX = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack);
int timer = ItemGunBaseNT.getAnimTimer(stack);
if(type == AnimType.RELOAD) {
if(timer == 20) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
if(timer == 55) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverSpin", 1F, 1F);
}
if(type == AnimType.CYCLE) {
if(timer == 21) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 11) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
}
if(type == AnimType.INSPECT) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverSpin", 1F, 1F);
}
};
}

View File

@ -0,0 +1,68 @@
package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiFunction;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.Crosshair;
import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.lib.RefStrings;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.item.ItemStack;
public class XFactoryBlackPowder {
public static void init() {
BulletConfig stone = new BulletConfig().setItem(EnumAmmo.STONE).setSpread(0.025F).setRicochetAngle(15);
BulletConfig flint = new BulletConfig().setItem(EnumAmmo.STONE_AP).setSpread(0.01F).setRicochetAngle(5);
BulletConfig shot = new BulletConfig().setItem(EnumAmmo.STONE_SHOT).setSpread(0.1F).setRicochetAngle(45).setProjectiles(6, 6).setDamage(0.2F);
ModItems.gun_pepperbox = new ItemGunBaseNT(new GunConfig()
.dura(300).draw(4).inspect(23).crosshair(Crosshair.L_CLASSIC).hud(Lego.HUD_COMPONENT_DURABILITY, Lego.HUD_COMPONENT_AMMO).smoke(true).orchestra(Orchestras.ORCHESTRA_PEPPERBOX)
.rec(new Receiver(0)
.dmg(5F).delay(27).reload(67).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 6).addConfigs(stone, flint, shot))
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE))
.pp(Lego.LAMBDA_STANDARD_CLICK_PRIMARY) .pr(Lego.LAMBDA_STANDARD_RELOAD) .pt(Lego.LAMBDA_TOGGLE_AIM)
.decider(GunStateDecider.LAMBDA_STANDARD_DECIDER)
.anim(LAMBDA_PEPPERBOX_ANIMS)
).setUnlocalizedName("gun_pepperbox").setTextureName(RefStrings.MODID + ":gun_darter");
}
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_PEPPERBOX_ANIMS = (stack, type) -> {
switch(type) {
case CYCLE: return new BusAnimation()
.addBus("ROTATE", new BusAnimationSequence().addPos(0, 0, 0, 1025).addPos(60, 0, 0, 250))
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, 0, 50).addPos(45, 0, 0, 150, IType.SIN_DOWN).addPos(45, 0, 0, 50).addPos(0, 0, 0, 500, IType.SIN_FULL))
.addBus("HAMMER", new BusAnimationSequence().addPos(80, 0, 0, 25).addPos(80, 0, 0, 1000).addPos(0, 0, 0, 250))
.addBus("TRIGGER", new BusAnimationSequence().addPos(1, 0, 0, 25).addPos(1, 0, 0, 250).addPos(0, 0, 0, 100));
case CYCLE_DRY: return new BusAnimation()
.addBus("ROTATE", new BusAnimationSequence().addPos(0, 0, 0, 525).addPos(60, 0, 0, 250))
.addBus("HAMMER", new BusAnimationSequence().addPos(80, 0, 0, 25).addPos(80, 0, 0, 500).addPos(0, 0, 0, 250))
.addBus("TRIGGER", new BusAnimationSequence().addPos(1, 0, 0, 25).addPos(1, 0, 0, 250).addPos(0, 0, 0, 100));
case EQUIP: return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence().addPos(-45, 0, 0, 0).addPos(0, 0, 0, 200, IType.SIN_DOWN));
case RELOAD: return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence().addPos(90, 0, 0, 500, IType.SIN_FULL).addPos(90, 0, 0, 1600).addPos(0, 0, 0, 500, IType.SIN_FULL).addPos(-5, 0, 0, 200, IType.SIN_UP).addPos(0, 0, 0, 200, IType.SIN_DOWN))
.addBus("TRANSLATE", new BusAnimationSequence().addPos(0, -12, 5, 500, IType.SIN_FULL).addPos(0, -12, 5, 700).addPos(0, -13, 5, 200).addPos(0, -12, 5, 200).addPos(0, -12, 5, 500).addPos(0, 0, 0, 500, IType.SIN_FULL))
.addBus("LOADER", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 5, -5, 0).addPos(0, 0, -0.1, 500, IType.SIN_FULL).addPos(0, 0, -1, 200).addPos(0, 0, -1, 200).addPos(0, 0, -0.1, 200).addPos(0, 5, -5, 500, IType.SIN_FULL).addPos(0, 0, 0, 0))
.addBus("ROTATE", new BusAnimationSequence().addPos(0, 0, 0, 2600).addPos(-360 * 1, 0, 0, 750, IType.SIN_FULL))
.addBus("SHOT", new BusAnimationSequence().addPos(1, 0, 0, 1400).addPos(0, 0, 0, 0));
case INSPECT: return new BusAnimation()
.addBus("ROTATE", new BusAnimationSequence().addPos(-360 * 1, 0, 0, 750, IType.SIN_FULL))
.addBus("RECOIL", new BusAnimationSequence().addPos(-5, 0, 0, 200, IType.SIN_UP).addPos(0, 0, 0, 200, IType.SIN_DOWN));
case JAMMED: break;
}
return null;
};
}

View File

@ -105,7 +105,6 @@ import com.hbm.render.item.*;
import com.hbm.render.item.ItemRenderMissileGeneric.RenderMissileType;
import com.hbm.render.item.block.*;
import com.hbm.render.item.weapon.*;
import com.hbm.render.item.weapon.sedna.*;
import com.hbm.render.loader.HmfModelLoader;
import com.hbm.render.model.ModelPigeon;
import com.hbm.render.tileentity.*;
@ -608,8 +607,6 @@ public class ClientProxy extends ServerProxy {
MinecraftForgeClient.registerItemRenderer(ModItems.gun_coilgun, new ItemRenderWeaponCoilgun());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_cryocannon, new ItemRenderWeaponCryoCannon());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_congolake, new ItemRenderWeaponCongo());
//SEDNA
MinecraftForgeClient.registerItemRenderer(ModItems.gun_debug, new ItemRenderDebug());
//multitool
MinecraftForgeClient.registerItemRenderer(ModItems.multitool_dig, new ItemRenderMultitool());
MinecraftForgeClient.registerItemRenderer(ModItems.multitool_silk, new ItemRenderMultitool());

View File

@ -845,6 +845,8 @@ public class ResourceManager {
public static final IModelCustom congolake = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/congolake.obj")).asVBO();
public static final IModelCustom lilmac = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/lilmac.obj")).asVBO();
public static final IModelCustom pepperbox = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/pepperbox.obj")).asVBO();
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"));
@ -953,7 +955,9 @@ public class ResourceManager {
public static final ResourceLocation congolake_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/congolake.png");
public static final ResourceLocation lilmac_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lilmac.png");
public static final ResourceLocation lilmac_scope_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lilmac_scope.png");
public static final ResourceLocation debug_gun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/debug_gun.png");
public static final ResourceLocation pepperbox_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/pepperbox.png");
public static final ResourceLocation lance_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lance.png");

View File

@ -14,7 +14,7 @@ import com.google.gson.JsonArray;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import com.hbm.render.anim.BusAnimationKeyframe.InterpolationType;
import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.BusAnimationSequence.Dimension;
public class AnimationLoader {
@ -143,7 +143,7 @@ public class AnimationLoader {
double value = array.get(0).getAsDouble();
int duration = array.get(1).getAsInt();
InterpolationType interpolation = array.size() >= 3 ? InterpolationType.valueOf(array.get(2).getAsString()) : InterpolationType.LINEAR;
IType interpolation = array.size() >= 3 ? IType.valueOf(array.get(2).getAsString()) : IType.LINEAR;
return new BusAnimationKeyframe(value, duration, interpolation);
}

View File

@ -6,20 +6,23 @@ public class BusAnimationKeyframe {
//whether the next frame "snaps" to the intended value or has interpolation
//it's an enum so stuff like accelerated animations between just
//two frames could be implemented
public static enum InterpolationType {
public static enum IType {
CONSTANT,
LINEAR
LINEAR,
SIN_UP,
SIN_DOWN,
SIN_FULL,
}
public double value;
public InterpolationType interpolationType;
public IType interpolationType;
public int duration;
//this one can be used for "reset" type keyframes
public BusAnimationKeyframe() {
this.value = 0;
this.duration = 1;
this.interpolationType = InterpolationType.LINEAR;
this.interpolationType = IType.LINEAR;
}
public BusAnimationKeyframe(double value, int duration) {
@ -28,7 +31,7 @@ public class BusAnimationKeyframe {
this.duration = duration;
}
public BusAnimationKeyframe(double value, int duration, InterpolationType interpolation) {
public BusAnimationKeyframe(double value, int duration, IType interpolation) {
this(value, duration);
this.interpolationType = interpolation;
}

View File

@ -3,7 +3,7 @@ package com.hbm.render.anim;
import java.util.ArrayList;
import java.util.List;
import com.hbm.render.anim.BusAnimationKeyframe.InterpolationType;
import com.hbm.render.anim.BusAnimationKeyframe.IType;
//the actual bus, a sequence of keyframes with their own behavior and such
public class BusAnimationSequence {
@ -50,10 +50,12 @@ public class BusAnimationSequence {
// Two helper methods for the old hard-coded animations
public BusAnimationSequence addPos(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 addPos(x, y, z, duration, IType.LINEAR);
}
public BusAnimationSequence addPos(double x, double y, double z, int duration, IType type) {
addKeyframe(Dimension.TX, new BusAnimationKeyframe(x, duration, type));
addKeyframe(Dimension.TY, new BusAnimationKeyframe(y, duration, type));
addKeyframe(Dimension.TZ, new BusAnimationKeyframe(z, duration, type));
return this;
}
@ -61,7 +63,6 @@ public class BusAnimationSequence {
addKeyframe(Dimension.RX, new BusAnimationKeyframe(x, duration));
addKeyframe(Dimension.RY, new BusAnimationKeyframe(y, duration));
addKeyframe(Dimension.RZ, new BusAnimationKeyframe(z, duration));
return this;
}
@ -77,33 +78,33 @@ public class BusAnimationSequence {
int startTime = 0;
int endTime = 0;
for (BusAnimationKeyframe keyframe: keyframes) {
for(BusAnimationKeyframe keyframe : keyframes) {
startTime = endTime;
endTime += keyframe.duration;
previousFrame = currentFrame;
currentFrame = keyframe;
if (millis < endTime) break;
if(millis < endTime) break;
}
if (currentFrame == null) {
if(currentFrame == null) {
// Scale defaults to 1, others are 0
transform[i] = i >= 6 ? 1 : 0;
continue;
}
if (millis >= endTime) {
if(millis >= endTime) {
transform[i] = currentFrame.value;
continue;
}
if (previousFrame != null && previousFrame.interpolationType == InterpolationType.CONSTANT) {
if(previousFrame != null && previousFrame.interpolationType == IType.CONSTANT) {
transform[i] = previousFrame.value;
continue;
}
double a = currentFrame.value;
double b = previousFrame != null ? previousFrame.value : 0;
double t = (double)(millis - startTime) / (double)currentFrame.duration;
double t = interpolate(startTime, millis, currentFrame.duration, currentFrame.interpolationType);
transform[i] = (a - b) * t + b;
}
@ -115,6 +116,14 @@ public class BusAnimationSequence {
return transform;
}
public double interpolate(double start, double end, double duration, IType interp) {
if(interp == IType.LINEAR) return (end - start) / duration;
if(interp == IType.SIN_UP) return -Math.sin(((end - start) / duration * Math.PI + Math.PI) / 2) + 1;
if(interp == IType.SIN_DOWN) return Math.sin((end - start) / duration * Math.PI / 2);
if(interp == IType.SIN_FULL) return (-Math.cos((end - start) / duration * Math.PI) + 1) / 2D;
return end - start;
}
public int getTotalTime() {
int highestTime = 0;

View File

@ -0,0 +1,129 @@
package com.hbm.render.item.weapon.sedna;
import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
public class ItemRenderPepperbox extends ItemRenderWeaponBase {
@Override
protected float getTurnMagnitude(ItemStack stack) { return ItemGunBaseNT.getIsAiming(stack) ? 2.5F : -0.25F; }
@Override
protected void setupFirstPerson(ItemStack stack) {
GL11.glTranslated(0, 0, 1.5);
float offset = 0.8F;
standardAimingTransform(stack,
-1.25F * offset, -0.75F * offset, 1F * offset,
0, -2.5 / 8D, 0.5);
}
@Override
public void renderFirstPerson(ItemStack stack) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
double scale = 0.25D;
GL11.glScaled(scale, scale, scale);
GL11.glShadeModel(GL11.GL_SMOOTH);
double[] recoil = HbmAnimations.getRelevantTransformation("RECOIL");
double[] cylinder = HbmAnimations.getRelevantTransformation("ROTATE");
double[] hammer = HbmAnimations.getRelevantTransformation("HAMMER");
double[] trigger = HbmAnimations.getRelevantTransformation("TRIGGER");
double[] translate = HbmAnimations.getRelevantTransformation("TRANSLATE");
double[] loader = HbmAnimations.getRelevantTransformation("LOADER");
double[] shot = HbmAnimations.getRelevantTransformation("SHOT");
GL11.glTranslated(translate[0], translate[1], translate[2]);
GL11.glTranslated(0, 0, -5);
GL11.glRotated(recoil[0], -1, 0, 0);
GL11.glTranslated(0, 0, 5);
GL11.glPushMatrix();
GL11.glTranslated(0, 0.5, 7);
GL11.glRotated(90, 0, 1, 0);
this.renderSmokeNodes(gun.smokeNodes, 0.5D);
GL11.glPopMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.pepperbox_tex);
if(loader[0] != 0 || loader[1] != 0 || loader[2] != 0) {
GL11.glPushMatrix();
GL11.glTranslated(loader[0], loader[1], loader[2]);
ResourceManager.pepperbox.renderPart("Speedloader");
if(shot[0] != 0) ResourceManager.pepperbox.renderPart("Shot");
GL11.glPopMatrix();
}
ResourceManager.pepperbox.renderPart("Grip");
GL11.glPushMatrix();
GL11.glRotated(cylinder[0], 0, 0, 1);
ResourceManager.pepperbox.renderPart("Cylinder");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0, 0.375, -1.875);
GL11.glRotated(hammer[0], 1, 0, 0);
GL11.glTranslated(0, -0.375, 1.875);
ResourceManager.pepperbox.renderPart("Hammer");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0, 0, -trigger[0] * 0.5);
ResourceManager.pepperbox.renderPart("Trigger");
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPushMatrix();
GL11.glTranslated(0, 0.5, 7);
GL11.glScaled(0.5, 0.5, 0.5);
GL11.glRotated(90, 0, 1, 0);
GL11.glRotated(90 * gun.shotRand, 1, 0, 0);
this.renderMuzzleFlash(gun.lastShot);
GL11.glRotated(45, 1, 0, 0);
this.renderMuzzleFlash(gun.lastShot);
GL11.glPopMatrix();
}
@Override
protected void setupThirdPerson(ItemStack stack) {
super.setupThirdPerson(stack);
GL11.glTranslated(0, 1, 3);
}
@Override
protected void setupInv(ItemStack stack) {
super.setupInv(stack);
double scale = 1.5D;
GL11.glScaled(scale, scale, scale);
GL11.glRotated(25, 1, 0, 0);
GL11.glRotated(45, 0, 1, 0);
GL11.glTranslated(0.5, 0.5, 0);
}
@Override
public void renderOther(ItemStack stack, ItemRenderType type) {
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.pepperbox_tex);
ResourceManager.pepperbox.renderPart("Grip");
ResourceManager.pepperbox.renderPart("Cylinder");
ResourceManager.pepperbox.renderPart("Hammer");
ResourceManager.pepperbox.renderPart("Trigger");
GL11.glShadeModel(GL11.GL_FLAT);
}
}

View File

@ -53,6 +53,24 @@ public class EntityDamageUtil {
}
}
public static float getDamageAfterTax(EntityLivingBase living, DamageSource source, float amount) {
amount = ForgeHooks.onLivingHurt(living, source, amount);
if(amount <= 0) return 0;
amount = applyArmorCalculations(living, source, amount);
return amount;
}
public static boolean attackArmorPiercing(EntityLivingBase living, DamageSource sourceDamageCalc, DamageSource sourceArmorPiercing, float amount, float piercing) {
if(piercing <= 0) return living.attackEntityFrom(sourceDamageCalc, amount);
//damage intended to pass the armor
float afterTax = getDamageAfterTax(living, sourceDamageCalc, amount);
//damage removed by the calculation
float reduced = Math.max(amount - afterTax, 0F);
//damage that would pass + damage tthat wouldn't pass * AP percentage
return living.attackEntityFrom(sourceArmorPiercing, Math.max(afterTax + (reduced * piercing), 0F));
}
/** Currently just a copy of the vanilla damage code */
public static boolean attackEntityFromNT(EntityLivingBase living, DamageSource source, float amount) {

File diff suppressed because it is too large Load Diff

View File

@ -220,6 +220,8 @@
"weapon.switchmode1": {"category": "player", "sounds": [{"name": "weapon/switchmode1", "stream": false}]},
"weapon.switchmode2": {"category": "player", "sounds": [{"name": "weapon/switchmode2", "stream": false}]},
"weapon.fire.blackPowder": {"category": "player", "sounds": [{"name": "weapon/fire/blackPowder", "stream": false}]},
"weapon.reload.boltClose": {"category": "player", "sounds": ["weapon/reload/boltClose"]},
"weapon.reload.boltOpen": {"category": "player", "sounds": ["weapon/reload/boltOpen"]},
"weapon.reload.closeClick": {"category": "player", "sounds": ["weapon/reload/closeClick"]},

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB