This commit is contained in:
Bob 2024-10-16 22:12:18 +02:00
parent a1401b47e2
commit 7d2df857e6
9 changed files with 264 additions and 37 deletions

View File

@ -1563,7 +1563,6 @@ public class ModItems {
public static Item gun_uzi_saturnite_silencer;
public static Item gun_uboinik;
public static Item gun_remington;
public static Item gun_spas12;
public static Item gun_supershotgun;
public static Item gun_benelli;
public static Item gun_ks23;
@ -1635,6 +1634,7 @@ public class ModItems {
public static Item gun_flamer;
public static Item gun_lag;
public static Item gun_uzi;
public static Item gun_spas12;
public static Item ammo_standard;
@ -4113,7 +4113,6 @@ public class ModItems {
gun_uzi_saturnite_silencer = new ItemGunBase(Gun22LRFactory.getSaturniteConfig().silenced()).setUnlocalizedName("gun_uzi_saturnite_silencer").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_uzi_saturnite_silencer");
gun_uboinik = new ItemGunBase(Gun12GaugeFactory.getUboinikConfig()).setUnlocalizedName("gun_uboinik").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_uboinik");
gun_remington = new ItemGunBase(Gun12GaugeFactory.getRemington870Config()).setUnlocalizedName("gun_remington").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_spas12");
gun_spas12 = new ItemGunBase(Gun12GaugeFactory.getSpas12Config(), Gun12GaugeFactory.getSpas12AltConfig()).setUnlocalizedName("gun_spas12").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_spas12");
gun_benelli = new ItemGunBase(Gun12GaugeFactory.getBenelliModConfig()).setUnlocalizedName("gun_benelli").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_spas12");
gun_supershotgun = new ItemGunShotty(Gun12GaugeFactory.getShottyConfig()).setUnlocalizedName("gun_supershotgun").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_uboinik");
gun_ks23 = new ItemGunBase(Gun4GaugeFactory.getKS23Config()).setUnlocalizedName("gun_ks23").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_uboinik");
@ -6965,7 +6964,6 @@ public class ModItems {
GameRegistry.registerItem(gun_uzi_saturnite_silencer,gun_uzi_saturnite_silencer.getUnlocalizedName());
GameRegistry.registerItem(gun_uboinik, gun_uboinik.getUnlocalizedName());
GameRegistry.registerItem(gun_remington, gun_remington.getUnlocalizedName());
GameRegistry.registerItem(gun_spas12, gun_spas12.getUnlocalizedName());
GameRegistry.registerItem(gun_benelli, gun_benelli.getUnlocalizedName());
GameRegistry.registerItem(gun_supershotgun, gun_supershotgun.getUnlocalizedName());
GameRegistry.registerItem(gun_ks23, gun_ks23.getUnlocalizedName());
@ -7024,6 +7022,7 @@ public class ModItems {
GameRegistry.registerItem(gun_flamer, gun_flamer.getUnlocalizedName());
GameRegistry.registerItem(gun_lag, gun_lag.getUnlocalizedName());
GameRegistry.registerItem(gun_uzi, gun_uzi.getUnlocalizedName());
GameRegistry.registerItem(gun_spas12, gun_spas12.getUnlocalizedName());
GameRegistry.registerItem(ammo_standard, ammo_standard.getUnlocalizedName());

View File

@ -17,27 +17,28 @@ import net.minecraft.util.Vec3;
*/
public class Receiver {
public static final String F_BASEDAMAGE = "F_BASEDAMAGE";
public static final String I_DELAYAFTERFIRE = "I_DELAYAFTERFIRE";
public static final String I_DELAYAFTERDRYFIRE = "I_DELAYAFTERDRYFIRE";
public static final String I_ROUNDSPERCYCLE = "I_ROUNDSPERCYCLE";
public static final String F_SPREADMOD = "F_SPREADMOD";
public static final String B_REFIREONHOLD = "B_REFIREONHOLD";
public static final String B_DOESDRYFIRE = "B_DOESDRYFIRE";
public static final String B_EJECTONFIRE = "B_EJECTONFIRE";
public static final String I_RELOADBEGINDURATION = "I_RELOADBEGINDURATION";
public static final String I_RELOADCYCLEDURATION = "I_RELOADCYCLEDURATION";
public static final String I_RELOADENDDURATION = "I_RELOADENDDURATION";
public static final String I_RELOADCOCKONEMPTY = "I_RELOADCOCKONEMPTY";
public static final String I_JAMDURATION = "I_JAMDURATION";
public static final String S_FIRESOUND = "S_FIRESOUND";
public static final String F_FIREVOLUME = "F_FIREVOLUME";
public static final String F_FIREPITCH = "F_FIREPITCH";
public static final String O_MAGAZINE = "O_MAGAZINE";
public static final String O_PROJECTILEOFFSET = "O_PROJECTILEOFFSET";
public static final String FUN_CANFIRE = "FUN_CANFIRE";
public static final String CON_ONFIRE = "CON_ONFIRE";
public static final String CON_ONRECOIL = "CON_ONRECOIL";
public static final String F_BASEDAMAGE = "F_BASEDAMAGE";
public static final String I_DELAYAFTERFIRE = "I_DELAYAFTERFIRE";
public static final String I_DELAYAFTERDRYFIRE = "I_DELAYAFTERDRYFIRE";
public static final String I_ROUNDSPERCYCLE = "I_ROUNDSPERCYCLE";
public static final String F_SPREADMOD = "F_SPREADMOD";
public static final String B_REFIREONHOLD = "B_REFIREONHOLD";
public static final String B_DOESDRYFIRE = "B_DOESDRYFIRE";
public static final String B_EJECTONFIRE = "B_EJECTONFIRE";
public static final String I_RELOADBEGINDURATION = "I_RELOADBEGINDURATION";
public static final String I_RELOADCYCLEDURATION = "I_RELOADCYCLEDURATION";
public static final String I_RELOADENDDURATION = "I_RELOADENDDURATION";
public static final String I_RELOADCOCKONEMPTYPRE = "I_RELOADCOCKONEMPTYPRE";
public static final String I_RELOADCOCKONEMPTYPOST = "I_RELOADCOCKONEMPTYPOST";
public static final String I_JAMDURATION = "I_JAMDURATION";
public static final String S_FIRESOUND = "S_FIRESOUND";
public static final String F_FIREVOLUME = "F_FIREVOLUME";
public static final String F_FIREPITCH = "F_FIREPITCH";
public static final String O_MAGAZINE = "O_MAGAZINE";
public static final String O_PROJECTILEOFFSET = "O_PROJECTILEOFFSET";
public static final String FUN_CANFIRE = "FUN_CANFIRE";
public static final String CON_ONFIRE = "CON_ONFIRE";
public static final String CON_ONRECOIL = "CON_ONRECOIL";
public Receiver(int index) {
this.index = index;
@ -55,7 +56,8 @@ public class Receiver {
protected int reloadBeginDuration_DNA;
protected int reloadCycleDuration_DNA;
protected int reloadEndDuration_DNA;
protected int reloadCockOnEmpty_DNA;
protected int reloadCockOnEmptyPre_DNA;
protected int reloadCockOnEmptyPost_DNA;
protected int jamDuration_DNA = 0;
protected String fireSound_DNA;
protected float fireVolume_DNA = 1.0F;
@ -78,7 +80,8 @@ public class Receiver {
public int getReloadBeginDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadBeginDuration_DNA, stack, I_RELOADBEGINDURATION, this); }
public int getReloadCycleDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadCycleDuration_DNA, stack, I_RELOADCYCLEDURATION, this); }
public int getReloadEndDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadEndDuration_DNA, stack, I_RELOADENDDURATION, this); }
public int getReloadCockOnEmpty(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadCockOnEmpty_DNA, stack, I_RELOADCOCKONEMPTY, this); }
public int getReloadCockOnEmptyPre(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadCockOnEmptyPre_DNA, stack, I_RELOADCOCKONEMPTYPRE, this); }
public int getReloadCockOnEmptyPost(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadCockOnEmptyPost_DNA, stack, I_RELOADCOCKONEMPTYPOST, this); }
public int getJamDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.jamDuration_DNA, stack, I_JAMDURATION, this); }
public String getFireSound(ItemStack stack) { return WeaponUpgradeManager.eval(this.fireSound_DNA, stack, S_FIRESOUND, this); }
public float getFireVolume(ItemStack stack) { return WeaponUpgradeManager.eval(this.fireVolume_DNA, stack, F_FIREVOLUME, this); }
@ -103,14 +106,14 @@ public class Receiver {
public Receiver offset(double f, double u, double s) { this.projectileOffset_DNA = Vec3.createVectorHelper(f, u, s); return this; }
public Receiver jam(int jam) { this.jamDuration_DNA = jam; return this; }
public Receiver reload(int delay) {
return reload(delay, delay, 0, 0);
}
public Receiver reload(int begin, int cycle, int end, int cock) {
public Receiver reload(int delay) { return reload(0, delay, delay, 0, 0); }
public Receiver reload(int begin, int cycle, int end, int cock) { return reload(0, begin, cycle, end, cock); }
public Receiver reload(int pre, int begin, int cycle, int end, int post) {
this.reloadBeginDuration_DNA = begin;
this.reloadCycleDuration_DNA = cycle;
this.reloadEndDuration_DNA = end;
this.reloadCockOnEmpty_DNA = cock;
this.reloadCockOnEmptyPre_DNA = pre;
this.reloadCockOnEmptyPost_DNA = post;
return this;
}

View File

@ -35,6 +35,7 @@ public class GunFactoryClient {
MinecraftForgeClient.registerItemRenderer(ModItems.gun_flamer, new ItemRenderFlamer());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_lag, new ItemRenderLAG());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_uzi, new ItemRenderUzi());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_spas12, new ItemRenderSPAS12());
//PROJECTILES
ammo_debug.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
ammo_debug_buckshot.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
@ -83,6 +84,7 @@ public class GunFactoryClient {
((ItemGunBaseNT) ModItems.gun_flamer) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO_NOCOUNTER);
((ItemGunBaseNT) ModItems.gun_lag) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_uzi) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_spas12) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_light_revolver_dani).getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY_MIRROR, LegoClient.HUD_COMPONENT_AMMO_MIRROR);
((ItemGunBaseNT) ModItems.gun_light_revolver_dani).getConfig(null, 1).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);

View File

@ -76,7 +76,7 @@ public class GunStateDecider {
ItemGunBaseNT.playAnimation(player, stack, AnimType.JAMMED, gunIndex);
} else {
ItemGunBaseNT.setState(stack, gunIndex, GunState.DRAWING);
int duration = rec.getReloadEndDuration(stack) + (mag.getAmountBeforeReload(stack) <= 0 ? rec.getReloadCockOnEmpty(stack) : 0);
int duration = rec.getReloadEndDuration(stack) + (mag.getAmountBeforeReload(stack) <= 0 ? rec.getReloadCockOnEmptyPost(stack) : 0);
ItemGunBaseNT.setTimer(stack, gunIndex, duration);
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD_END, gunIndex);
}

View File

@ -50,9 +50,10 @@ public class Lego {
IMagazine mag = rec.getMagazine(stack);
if(mag.canReload(stack, ctx.player)) {
mag.setAmountBeforeReload(stack, mag.getAmount(stack));
int loaded = mag.getAmount(stack);
mag.setAmountBeforeReload(stack, loaded);
ItemGunBaseNT.setState(stack, ctx.configIndex, GunState.RELOADING);
ItemGunBaseNT.setTimer(stack, ctx.configIndex, rec.getReloadBeginDuration(stack));
ItemGunBaseNT.setTimer(stack, ctx.configIndex, rec.getReloadBeginDuration(stack) + (loaded <= 0 ? rec.getReloadCockOnEmptyPre(stack) : 0));
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD, ctx.configIndex);
} else {
ItemGunBaseNT.playAnimation(player, stack, AnimType.INSPECT, ctx.configIndex);
@ -149,9 +150,13 @@ public class Lego {
/** Spawns an EntityBulletBaseMK4 with the loaded bulletcfg */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_FIRE = (stack, ctx) -> {
doStandardFire(stack, ctx, AnimType.CYCLE);
};
public static void doStandardFire(ItemStack stack, LambdaContext ctx, AnimType anim) {
EntityPlayer player = ctx.player;
int index = ctx.configIndex;
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE, ctx.configIndex);
if(anim != null) ItemGunBaseNT.playAnimation(player, stack, anim, ctx.configIndex);
float aim = ItemGunBaseNT.getIsAiming(stack) ? 0.25F : 1F;
Receiver primary = ctx.config.getReceivers(stack)[0];
@ -179,7 +184,7 @@ public class Lego {
mag.setAmount(stack, mag.getAmount(stack) - 1);
ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + config.wear, ctx.config.getDurability(stack)));
};
}
public static float getStandardWearSpread(ItemStack stack, GunConfig config, int index) {
float percent = (float) ItemGunBaseNT.getWear(stack, index) / config.getDurability(stack);

View File

@ -547,4 +547,31 @@ public class Orchestras {
if(timer == 31) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 1F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_SPAS = (stack, ctx) -> {
EntityPlayer player = ctx.player;
if(player.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.CYCLE || type == AnimType.ALT_CYCLE) {
if(timer == 8) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.shotgunCock", 1F, 1F);
if(timer == 10) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
if(casing != null) CasingCreator.composeEffect(player.worldObj, player, 0.375, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, 0.01, casing.getName());
}
}
if(type == AnimType.RELOAD) {
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
if(mag.getAmount(stack) == 0) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
if(timer == 7) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
}
if(timer == 5) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.shotgunReload", 1F, 1F);
}
if(type == AnimType.RELOAD_CYCLE) {
if(timer == 5) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.shotgunReload", 1F, 1F);
}
};
}

View File

@ -1,5 +1,6 @@
package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import com.hbm.items.ModItems;
@ -8,9 +9,12 @@ 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.GunState;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.BusAnimation;
@ -18,6 +22,7 @@ import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class XFactory12ga {
@ -55,7 +60,47 @@ public class XFactory12ga {
.setupStandardConfiguration()
.anim(LAMBDA_LIBERATOR_ANIMS).orchestra(Orchestras.ORCHESTRA_LIBERATOR)
).setUnlocalizedName("gun_liberator").setTextureName(RefStrings.MODID + ":gun_darter");
ModItems.gun_spas12 = new ItemGunBaseNT(new GunConfig()
.dura(600).draw(20).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(12F).delay(20).reload(5, 10, 10, 10, 0).jam(24).sound("hbm:weapon.shotgunShoot", 1.0F, 1.0F)
.mag(new MagazineSingleReload(0, 8).addConfigs(g12_bp, g12_bp_magnum, g12_bp_slug, g12))
.offset(0.75, -0.0625, -0.1875D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration().ps(LAMBDA_SPAS_SECONDARY).pt(null)
.anim(LAMBDA_SPAS_ANIMS).orchestra(Orchestras.ORCHESTRA_SPAS)
).setUnlocalizedName("gun_spas12").setTextureName(RefStrings.MODID + ":gun_darter");
}
//TODO: make generic code for this crap
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SPAS_SECONDARY = (stack, ctx) -> {
EntityPlayer player = ctx.player;
Receiver rec = ctx.config.getReceivers(stack)[0];
int index = ctx.configIndex;
GunState state = ItemGunBaseNT.getState(stack, index);
if(state == GunState.IDLE) {
if(rec.getCanFire(stack).apply(stack, ctx)) {
rec.getOnFire(stack).accept(stack, ctx);
int remaining = rec.getRoundsPerCycle(stack);
int timeFired = 1;
for(int i = 0; i < remaining; i++) {
if(rec.getCanFire(stack).apply(stack, ctx)) {
rec.getOnFire(stack).accept(stack, ctx);
timeFired++;
}
}
if(rec.getFireSound(stack) != null) player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, rec.getFireSound(stack), rec.getFireVolume(stack), rec.getFirePitch(stack) * (timeFired > 1 ? 0.9F : 1F));
ItemGunBaseNT.setState(stack, index, GunState.COOLDOWN);
ItemGunBaseNT.setTimer(stack, index, 10);
} else {
if(rec.getDoesDryFire(stack)) {
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE_DRY, index);
ItemGunBaseNT.setState(stack, index, GunState.DRAWING);
ItemGunBaseNT.setTimer(stack, index, rec.getDelayAfterDryFire(stack));
}
}
}
};
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_MARESLEG_ANIMS = (stack, type) -> {
switch(type) {
@ -197,4 +242,22 @@ public class XFactory12ga {
return null;
};
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_SPAS_ANIMS = (stack, type) -> {
switch(type) {
case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-60, 0, 0, 0).addPos(0, 0, -3, 500, IType.SIN_DOWN));
case CYCLE: return ResourceManager.spas_12_anim.get("Fire");
case CYCLE_DRY: return new BusAnimation();
case RELOAD:
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack) <= 0;
return ResourceManager.spas_12_anim.get(empty ? "ReloadEmptyStart" : "ReloadStart");
case RELOAD_CYCLE: return ResourceManager.spas_12_anim.get("Reload");
case RELOAD_END: return ResourceManager.spas_12_anim.get("ReloadEnd");
case JAMMED: return new BusAnimation();
case INSPECT: return new BusAnimation();
}
return null;
};
}

View File

@ -590,7 +590,6 @@ public class ClientProxy extends ServerProxy {
MinecraftForgeClient.registerItemRenderer(ModItems.gun_ar15, new ItemRenderWeaponAR15());
MinecraftForgeClient.registerItemRenderer(ModItems.detonator_laser, new ItemRenderDetonatorLaser());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_remington, new ItemRenderWeaponRemington());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_spas12, new ItemRenderWeaponSpas12());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_glass_cannon, new ItemRenderWeaponGlass());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_chemthrower, new ItemRenderWeaponChemthrower());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_m2, new ItemRenderM2());

View File

@ -0,0 +1,129 @@
package com.hbm.render.item.weapon.sedna;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing;
import com.hbm.render.anim.HbmAnimations;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
public class ItemRenderSPAS12 extends ItemRenderWeaponBase {
@Override
protected float getTurnMagnitude(ItemStack stack) { return ItemGunBaseNT.getIsAiming(stack) ? 2.5F : -0.5F; }
@Override
public void setupFirstPerson(ItemStack stack) {
GL11.glTranslated(0, 0, 0.875);
float offset = 0.8F;
standardAimingTransform(stack,
-1.25F * offset, -1.75F * offset, -0.5F * offset,
0, 0, 0);
}
@Override
public void renderFirstPerson(ItemStack stack) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.spas_12_tex);
double scale = 0.5D;
GL11.glScaled(scale, scale, scale);
GL11.glRotated(180, 0, 1, 0);
double[] equip = HbmAnimations.getRelevantTransformation("EQUIP");
GL11.glRotated(equip[0], 1, 0, 0);
GL11.glShadeModel(GL11.GL_SMOOTH);
HbmAnimations.applyRelevantTransformation("MainBody");
ResourceManager.spas_12.renderPart("MainBody");
GL11.glPushMatrix();
HbmAnimations.applyRelevantTransformation("PumpGrip");
ResourceManager.spas_12.renderPart("PumpGrip");
GL11.glPopMatrix();
GL11.glPushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.casings_tex);
HbmAnimations.applyRelevantTransformation("Shell");
SpentCasing casing = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
int color0 = SpentCasing.COLOR_CASE_BRASS;
int color1 = SpentCasing.COLOR_CASE_BRASS;
if(casing != null) {
int[] colors = casing.getColors();
color0 = colors[0];
color1 = colors[colors.length > 1 ? 1 : 0];
}
Color shellColor = new Color(color1);
GL11.glColor3f(shellColor.getRed() / 255F, shellColor.getGreen() / 255F, shellColor.getBlue() / 255F);
ResourceManager.spas_12.renderPart("Shell");
Color shellForeColor = new Color(color0);
GL11.glColor3f(shellForeColor.getRed() / 255F, shellForeColor.getGreen() / 255F, shellForeColor.getBlue() / 255F);
ResourceManager.spas_12.renderPart("ShellFore");
GL11.glColor3f(1F, 1F, 1F);
double smokeScale = 0.25;
GL11.glPushMatrix();
GL11.glTranslated(0, 1.5, -11);
GL11.glRotated(-90, 0, 1, 0);
GL11.glScaled(smokeScale, smokeScale, smokeScale);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 0.75D);
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPushMatrix();
GL11.glTranslated(0, 1.5, -11);
GL11.glRotated(-90, 0, 1, 0);
GL11.glRotated(90 * gun.shotRand, 1, 0, 0);
this.renderMuzzleFlash(gun.lastShot[0], 75, 7.5);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
@Override
public void setupThirdPerson(ItemStack stack) {
super.setupThirdPerson(stack);
double scale = 1.75D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(0, -0.75, 0);
}
@Override
public void setupInv(ItemStack stack) {
super.setupInv(stack);
double scale = 2D;
GL11.glScaled(scale, scale, scale);
GL11.glRotated(25, 1, 0, 0);
GL11.glRotated(45, 0, 1, 0);
GL11.glTranslated(4.25, -0.5, 0);
}
@Override
public void renderOther(ItemStack stack, ItemRenderType type) {
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glRotated(180, 0, 1, 0);
GL11.glShadeModel(GL11.GL_SMOOTH);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.spas_12_tex);
ResourceManager.spas_12.renderPart("MainBody");
ResourceManager.spas_12.renderPart("PumpGrip");
GL11.glShadeModel(GL11.GL_FLAT);
}
}