Merge remote-tracking branch 'upstream/master' into Optimization

This commit is contained in:
BallOfEnergy 2024-10-13 15:51:07 -05:00
commit 60536af06c
29 changed files with 459 additions and 107 deletions

View File

@ -25,9 +25,12 @@ public class ClientConfig {
public static ConfigWrapper<Integer> GEIGER_OFFSET_HORIZONTAL = new ConfigWrapper(0); public static ConfigWrapper<Integer> GEIGER_OFFSET_HORIZONTAL = new ConfigWrapper(0);
public static ConfigWrapper<Integer> GEIGER_OFFSET_VERTICAL = new ConfigWrapper(0); public static ConfigWrapper<Integer> GEIGER_OFFSET_VERTICAL = new ConfigWrapper(0);
public static ConfigWrapper<Boolean> GUN_ANIMS_LEGACY = new ConfigWrapper(false);
private static void initDefaults() { private static void initDefaults() {
configMap.put("GEIGER_OFFSET_HORIZONTAL", GEIGER_OFFSET_HORIZONTAL); configMap.put("GEIGER_OFFSET_HORIZONTAL", GEIGER_OFFSET_HORIZONTAL);
configMap.put("GEIGER_OFFSET_VERTICAL", GEIGER_OFFSET_VERTICAL); configMap.put("GEIGER_OFFSET_VERTICAL", GEIGER_OFFSET_VERTICAL);
configMap.put("GUN_ANIMS_LEGACY", GUN_ANIMS_LEGACY);
} }
public static void initConfig() { public static void initConfig() {

View File

@ -45,6 +45,7 @@ public class WeaponRecipes {
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_am180, 1), new Object[] { "BBR", "GMS", 'B', DURA.lightBarrel(), 'R', DURA.lightReceiver(), 'M', GUNMETAL.mechanism(), 'G', WOOD.grip(), 'S', WOOD.stock() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_am180, 1), new Object[] { "BBR", "GMS", 'B', DURA.lightBarrel(), 'R', DURA.lightReceiver(), 'M', GUNMETAL.mechanism(), 'G', WOOD.grip(), 'S', WOOD.stock() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_liberator, 1), new Object[] { "BB ", "BBM", "G G", 'B', DURA.lightBarrel(), 'M', GUNMETAL.mechanism(), 'G', WOOD.grip() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_liberator, 1), new Object[] { "BB ", "BBM", "G G", 'B', DURA.lightBarrel(), 'M', GUNMETAL.mechanism(), 'G', WOOD.grip() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_congolake, 1), new Object[] { "BM ", "BRS", "G ", 'B', DURA.heavyBarrel(), 'M', GUNMETAL.mechanism(), 'R', DURA.lightReceiver(), 'S', WOOD.stock(), 'G', WOOD.grip() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_congolake, 1), new Object[] { "BM ", "BRS", "G ", 'B', DURA.heavyBarrel(), 'M', GUNMETAL.mechanism(), 'R', DURA.lightReceiver(), 'S', WOOD.stock(), 'G', WOOD.grip() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_flamer, 1), new Object[] { " MG", "BBR", " GM", 'M', GUNMETAL.mechanism(), 'G', DURA.grip(), 'B', DURA.heavyBarrel(), 'R', DURA.heavyReceiver() });
//SEDNA Ammo //SEDNA Ammo
CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.STONE, 6), new Object[] { "C", "P", "G", 'C', KEY_COBBLESTONE, 'P', Items.paper, 'G', Items.gunpowder }); CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.STONE, 6), new Object[] { "C", "P", "G", 'C', KEY_COBBLESTONE, 'P', Items.paper, 'G', Items.gunpowder });

View File

@ -165,12 +165,15 @@ public class EntityBulletBaseMK4 extends EntityThrowableInterp {
if(mop.typeOfHit == mop.typeOfHit.ENTITY) { if(mop.typeOfHit == mop.typeOfHit.ENTITY) {
Entity entity = mop.entityHit; Entity entity = mop.entityHit;
if(!entity.isEntityAlive()) return;
if(entity instanceof EntityLivingBase && ((EntityLivingBase) entity).getHealth() <= 0) {
return;
}
DamageSource damageCalc = this.config.getDamage(this, getThrower(), false); DamageSource damageCalc = this.config.getDamage(this, getThrower(), false);
if(!(entity instanceof EntityLivingBase)) { if(!(entity instanceof EntityLivingBase)) {
entity.attackEntityFrom(damageCalc, this.damage); EntityDamageUtil.attackEntityFromIgnoreIFrame(entity, damageCalc, this.damage);
return; return;
} }

View File

@ -2,6 +2,7 @@ package com.hbm.explosion.vanillant.standard;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map.Entry;
import com.hbm.explosion.vanillant.ExplosionVNT; import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.interfaces.ICustomDamageHandler; import com.hbm.explosion.vanillant.interfaces.ICustomDamageHandler;
@ -59,6 +60,8 @@ public class EntityProcessorCross implements IEntityProcessor {
ForgeDirection dir = ForgeDirection.getOrientation(i); ForgeDirection dir = ForgeDirection.getOrientation(i);
nodes[i] = Vec3.createVectorHelper(x + dir.offsetX * nodeDist, y + dir.offsetY * nodeDist, z + dir.offsetZ * nodeDist); nodes[i] = Vec3.createVectorHelper(x + dir.offsetX * nodeDist, y + dir.offsetY * nodeDist, z + dir.offsetZ * nodeDist);
} }
HashMap<Entity, Float> damageMap = new HashMap();
for(int index = 0; index < list.size(); ++index) { for(int index = 0; index < list.size(); ++index) {
@ -89,7 +92,8 @@ public class EntityProcessorCross implements IEntityProcessor {
double knockback = (1.0D - distanceScaled) * density; double knockback = (1.0D - distanceScaled) * density;
entity.attackEntityFrom(setExplosionSource(explosion.compat), calculateDamage(distanceScaled, density, knockback, size)); float dmg = calculateDamage(distanceScaled, density, knockback, size);
if(!damageMap.containsKey(entity) || damageMap.get(entity) < dmg) damageMap.put(entity, dmg);
double enchKnockback = EnchantmentProtection.func_92092_a(entity, knockback); double enchKnockback = EnchantmentProtection.func_92092_a(entity, knockback);
entity.motionX += deltaX * enchKnockback; entity.motionX += deltaX * enchKnockback;
@ -99,14 +103,22 @@ public class EntityProcessorCross implements IEntityProcessor {
if(entity instanceof EntityPlayer) { if(entity instanceof EntityPlayer) {
affectedPlayers.put((EntityPlayer) entity, Vec3.createVectorHelper(deltaX * knockback, deltaY * knockback, deltaZ * knockback)); affectedPlayers.put((EntityPlayer) entity, Vec3.createVectorHelper(deltaX * knockback, deltaY * knockback, deltaZ * knockback));
} }
if(damage != null) {
damage.handleAttack(explosion, entity, distanceScaled);
}
} }
} }
} }
for(Entry<Entity, Float> entry : damageMap.entrySet()) {
Entity entity = entry.getKey();
entity.attackEntityFrom(setExplosionSource(explosion.compat), entry.getValue());
System.out.println(entity + " " + entry.getValue());
if(damage != null) {
double distanceScaled = entity.getDistance(x, y, z) / size;
damage.handleAttack(explosion, entity, distanceScaled);
}
}
return affectedPlayers; return affectedPlayers;
} }

View File

@ -0,0 +1,28 @@
package com.hbm.explosion.vanillant.standard;
import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.interfaces.IExplosionSFX;
import com.hbm.particle.helper.ExplosionSmallCreator;
import net.minecraft.world.World;
public class ExplosionEffectWeapon implements IExplosionSFX {
int cloudCount;
float cloudScale;
float cloudSpeedMult;
public ExplosionEffectWeapon(int cloudCount, float cloudScale, float cloudSpeedMult) {
this.cloudCount = cloudCount;
this.cloudScale = cloudScale;
this.cloudSpeedMult = cloudSpeedMult;
}
@Override
public void doEffect(ExplosionVNT explosion, World world, double x, double y, double z, float size) {
if(world.isRemote) return;
world.playSoundEffect(x, y, z, "random.explode", 4.0F, (1.0F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.9F);
ExplosionSmallCreator.composeEffect(world, x, y, z, cloudCount, cloudScale, cloudSpeedMult);
}
}

View File

@ -136,7 +136,7 @@ public class Mats {
public static final NTMMaterial MAT_STEEL = makeSmeltable(_AS + 0, STEEL, 0xAFAFAF, 0x0F0F0F, 0x4A4A4A).setShapes(DUSTTINY, BOLT, WIRE, INGOT, DUST, PLATE, CASTPLATE, WELDEDPLATE, SHELL, PIPE, BLOCK, HEAVY_COMPONENT, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, GRIP).m(); public static final NTMMaterial MAT_STEEL = makeSmeltable(_AS + 0, STEEL, 0xAFAFAF, 0x0F0F0F, 0x4A4A4A).setShapes(DUSTTINY, BOLT, WIRE, INGOT, DUST, PLATE, CASTPLATE, WELDEDPLATE, SHELL, PIPE, BLOCK, HEAVY_COMPONENT, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, GRIP).m();
public static final NTMMaterial MAT_MINGRADE = makeSmeltable(_AS + 1, MINGRADE, 0xFFBA7D, 0xAF1700, 0xE44C0F).setShapes(WIRE, INGOT, DUST, BLOCK).m(); public static final NTMMaterial MAT_MINGRADE = makeSmeltable(_AS + 1, MINGRADE, 0xFFBA7D, 0xAF1700, 0xE44C0F).setShapes(WIRE, INGOT, DUST, BLOCK).m();
public static final NTMMaterial MAT_ALLOY = makeSmeltable(_AS + 2, ALLOY, 0xFF8330, 0x700000, 0xFF7318).setShapes(WIRE, INGOT, DUST, DENSEWIRE, PLATE, CASTPLATE, BLOCK, HEAVY_COMPONENT).m(); public static final NTMMaterial MAT_ALLOY = makeSmeltable(_AS + 2, ALLOY, 0xFF8330, 0x700000, 0xFF7318).setShapes(WIRE, INGOT, DUST, DENSEWIRE, PLATE, CASTPLATE, BLOCK, HEAVY_COMPONENT).m();
public static final NTMMaterial MAT_DURA = makeSmeltable(_AS + 3, DURA, 0x183039, 0x030B0B, 0x376373).setShapes(BOLT, INGOT, DUST, PIPE, BLOCK, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, GRIP).m(); public static final NTMMaterial MAT_DURA = makeSmeltable(_AS + 3, DURA, 0x183039, 0x030B0B, 0x376373).setShapes(BOLT, INGOT, DUST, PIPE, BLOCK, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, GRIP).m();
public static final NTMMaterial MAT_DESH = makeSmeltable(_AS + 12, DESH, 0xFF6D6D, 0x720000, 0xF22929).setShapes(INGOT, DUST, CASTPLATE, BLOCK, HEAVY_COMPONENT).m(); public static final NTMMaterial MAT_DESH = makeSmeltable(_AS + 12, DESH, 0xFF6D6D, 0x720000, 0xF22929).setShapes(INGOT, DUST, CASTPLATE, BLOCK, HEAVY_COMPONENT).m();
public static final NTMMaterial MAT_STAR = makeSmeltable(_AS + 5, STAR, 0xCCCCEA, 0x11111A, 0xA5A5D3).setShapes(INGOT, DUST, DENSEWIRE, BLOCK).m(); public static final NTMMaterial MAT_STAR = makeSmeltable(_AS + 5, STAR, 0xCCCCEA, 0x11111A, 0xA5A5D3).setShapes(INGOT, DUST, DENSEWIRE, BLOCK).m();
public static final NTMMaterial MAT_FERRO = makeSmeltable(_AS + 7, FERRO, 0xB7B7C9, 0x101022, 0x6B6B8B).setShapes(INGOT).m(); public static final NTMMaterial MAT_FERRO = makeSmeltable(_AS + 7, FERRO, 0xB7B7C9, 0x101022, 0x6B6B8B).setShapes(INGOT).m();

View File

@ -1,5 +1,6 @@
package com.hbm.items.weapon.sedna; package com.hbm.items.weapon.sedna;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import com.hbm.handler.CasingEjector; import com.hbm.handler.CasingEjector;
@ -14,6 +15,7 @@ import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.packet.toclient.GunAnimationPacket; import com.hbm.packet.toclient.GunAnimationPacket;
import com.hbm.render.anim.HbmAnimations.AnimType; import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay; import com.hbm.render.util.RenderScreenOverlay;
import com.hbm.sound.AudioWrapper;
import com.hbm.util.EnumUtil; import com.hbm.util.EnumUtil;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
@ -56,6 +58,8 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
public static final String KEY_RELOAD = "reload_"; public static final String KEY_RELOAD = "reload_";
public static final String KEY_LASTANIM = "lastanim_"; public static final String KEY_LASTANIM = "lastanim_";
public static final String KEY_ANIMTIMER = "animtimer_"; public static final String KEY_ANIMTIMER = "animtimer_";
public static ConcurrentHashMap<EntityPlayer, AudioWrapper> loopedSounds = new ConcurrentHashMap();
public static float prevAimingProgress; public static float prevAimingProgress;
public static float aimingProgress; public static float aimingProgress;
@ -157,6 +161,11 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
for(int i = 0; i < confNo; i++) if(configs[i].getSmokeHandler(stack) != null) { for(int i = 0; i < confNo; i++) if(configs[i].getSmokeHandler(stack) != null) {
configs[i].getSmokeHandler(stack).accept(stack, ctx[i]); configs[i].getSmokeHandler(stack).accept(stack, ctx[i]);
} }
for(int i = 0; i < confNo; i++) {
BiConsumer<ItemStack, LambdaContext> orchestra = configs[i].getOrchestra(stack);
if(orchestra != null) orchestra.accept(stack, ctx[i]);
}
} }
return; return;
} }

View File

@ -78,7 +78,7 @@ public class GunFactoryClient {
((ItemGunBaseNT) ModItems.gun_am180) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_am180) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_liberator) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_liberator) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_congolake) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_congolake) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_flamer) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_flamer) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO_NOCOUNTER);
((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, 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); ((ItemGunBaseNT) ModItems.gun_light_revolver_dani).getConfig(null, 1).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);

View File

@ -8,7 +8,7 @@ import java.util.function.BiFunction;
import com.hbm.entity.projectile.EntityBulletBaseMK4; import com.hbm.entity.projectile.EntityBulletBaseMK4;
import com.hbm.explosion.vanillant.ExplosionVNT; import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth; import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth;
import com.hbm.explosion.vanillant.standard.ExplosionEffectStandard; import com.hbm.explosion.vanillant.standard.ExplosionEffectWeapon;
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard; import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
import com.hbm.items.weapon.sedna.BulletConfig; import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.GunConfig; import com.hbm.items.weapon.sedna.GunConfig;
@ -197,7 +197,7 @@ public class Lego {
ExplosionVNT vnt = new ExplosionVNT(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, range); ExplosionVNT vnt = new ExplosionVNT(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, range);
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, bullet.damage)); vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, bullet.damage));
vnt.setPlayerProcessor(new PlayerProcessorStandard()); vnt.setPlayerProcessor(new PlayerProcessorStandard());
vnt.setSFX(new ExplosionEffectStandard()); vnt.setSFX(new ExplosionEffectWeapon(10, 2.5F, 1F));
vnt.explode(); vnt.explode();
} }

View File

@ -21,7 +21,8 @@ public class LegoClient {
public static HUDComponentDurabilityBar HUD_COMPONENT_DURABILITY = new HUDComponentDurabilityBar(); public static HUDComponentDurabilityBar HUD_COMPONENT_DURABILITY = new HUDComponentDurabilityBar();
public static HUDComponentDurabilityBar HUD_COMPONENT_DURABILITY_MIRROR = new HUDComponentDurabilityBar(true); public static HUDComponentDurabilityBar HUD_COMPONENT_DURABILITY_MIRROR = new HUDComponentDurabilityBar(true);
public static HUDComponentAmmoCounter HUD_COMPONENT_AMMO = new HUDComponentAmmoCounter(0); public static HUDComponentAmmoCounter HUD_COMPONENT_AMMO = new HUDComponentAmmoCounter(0);
public static HUDComponentAmmoCounter HUD_COMPONENT_AMMO_MIRROR = new HUDComponentAmmoCounter(0, true); public static HUDComponentAmmoCounter HUD_COMPONENT_AMMO_MIRROR = new HUDComponentAmmoCounter(0).mirror();
public static HUDComponentAmmoCounter HUD_COMPONENT_AMMO_NOCOUNTER = new HUDComponentAmmoCounter(0).noCounter();
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_STANDARD_BULLET = (bullet, interp) -> { public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_STANDARD_BULLET = (bullet, interp) -> {
double length = bullet.prevVelocity + (bullet.velocity - bullet.prevVelocity) * interp; double length = bullet.prevVelocity + (bullet.velocity - bullet.prevVelocity) * interp;

View File

@ -2,13 +2,16 @@ package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import com.hbm.config.ClientConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver; import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.main.MainRegistry;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.helper.CasingCreator; import com.hbm.particle.helper.CasingCreator;
import com.hbm.render.anim.HbmAnimations.AnimType; import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.sound.AudioWrapper;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -20,6 +23,7 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> DEBUG_ORCHESTRA = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> DEBUG_ORCHESTRA = (stack, ctx) -> {
EntityPlayer player = ctx.player; EntityPlayer player = ctx.player;
if(player.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
@ -51,6 +55,7 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_PEPPERBOX = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_PEPPERBOX = (stack, ctx) -> {
EntityPlayer player = ctx.player; EntityPlayer player = ctx.player;
if(player.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
@ -76,6 +81,7 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_ATLAS = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_ATLAS = (stack, ctx) -> {
EntityPlayer player = ctx.player; EntityPlayer player = ctx.player;
if(player.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
@ -103,6 +109,7 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_DANI = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_DANI = (stack, ctx) -> {
EntityPlayer player = ctx.player; EntityPlayer player = ctx.player;
if(player.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
@ -130,6 +137,7 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_HENRY = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_HENRY = (stack, ctx) -> {
EntityPlayer player = ctx.player; EntityPlayer player = ctx.player;
if(player.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack); boolean aiming = ItemGunBaseNT.getIsAiming(stack);
@ -166,6 +174,7 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_GREASEGUN = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_GREASEGUN = (stack, ctx) -> {
EntityPlayer player = ctx.player; EntityPlayer player = ctx.player;
if(player.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack); boolean aiming = ItemGunBaseNT.getIsAiming(stack);
@ -201,6 +210,7 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_MARESLEG = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_MARESLEG = (stack, ctx) -> {
EntityPlayer player = ctx.player; EntityPlayer player = ctx.player;
if(player.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack); boolean aiming = ItemGunBaseNT.getIsAiming(stack);
@ -235,6 +245,7 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_FLAREGUN = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_FLAREGUN = (stack, ctx) -> {
EntityPlayer player = ctx.player; EntityPlayer player = ctx.player;
if(player.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack); boolean aiming = ItemGunBaseNT.getIsAiming(stack);
@ -263,6 +274,7 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_NOPIP = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_NOPIP = (stack, ctx) -> {
EntityPlayer player = ctx.player; EntityPlayer player = ctx.player;
if(player.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
@ -294,6 +306,7 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_CARBIBE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_CARBIBE = (stack, ctx) -> {
EntityPlayer player = ctx.player; EntityPlayer player = ctx.player;
if(player.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack); boolean aiming = ItemGunBaseNT.getIsAiming(stack);
@ -327,37 +340,66 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_AM180 = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_AM180 = (stack, ctx) -> {
EntityPlayer player = ctx.player; EntityPlayer player = ctx.player;
if(player.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack); boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.CYCLE) { if(ClientConfig.GUN_ANIMS_LEGACY.get()) {
if(timer == 0) { if(type == AnimType.CYCLE) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); if(timer == 0) {
CasingCreator.composeEffect(player.worldObj, player, 0.4375, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, -0.06, 0, 0.01, casing.getName()); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
CasingCreator.composeEffect(player.worldObj, player, 0.4375, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, -0.06, 0, 0.01, casing.getName());
}
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 6) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.9F);
}
if(type == AnimType.RELOAD) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magRemove", 1F, 1F);
if(timer == 20) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.impact", 0.25F, 1F);
if(timer == 32) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magInsert", 1F, 1F);
if(timer == 40) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.9F);
}
if(type == AnimType.JAMMED) {
if(timer == 15) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.8F);
}
if(type == AnimType.INSPECT) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magRemove", 1F, 1F);
if(timer == 35) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magInsert", 1F, 1F);
}
} else {
if(type == AnimType.CYCLE) {
if(timer == 0) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
CasingCreator.composeEffect(player.worldObj, player, 0.4375, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, -0.06, 0, 0.01, casing.getName());
}
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 6) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.9F);
}
if(type == AnimType.RELOAD) {
if(timer == 6) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magRemove", 1F, 1F);
if(timer == 26) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.impact", 0.25F, 1F);
if(timer == 48) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magInsert", 1F, 1F);
if(timer == 54) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.9F);
}
if(type == AnimType.JAMMED) {
if(timer == 6) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.8F);
if(timer == 20) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 1.0F);
}
if(type == AnimType.INSPECT) {
if(timer == 6) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magRemove", 1F, 1F);
if(timer == 53) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magInsert", 1F, 1F);
} }
}
if(type == AnimType.CYCLE_DRY) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F);
if(timer == 6) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.9F);
}
if(type == AnimType.RELOAD) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magRemove", 1F, 1F);
if(timer == 20) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.impact", 0.25F, 1F);
if(timer == 32) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magInsert", 1F, 1F);
if(timer == 40) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.9F);
}
if(type == AnimType.JAMMED) {
if(timer == 15) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pistolCock", 1F, 0.8F);
}
if(type == AnimType.INSPECT) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magRemove", 1F, 1F);
if(timer == 35) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magInsert", 1F, 1F);
} }
}; };
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_LIBERATOR = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_LIBERATOR = (stack, ctx) -> {
EntityPlayer player = ctx.player; EntityPlayer player = ctx.player;
if(player.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
@ -400,6 +442,7 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_CONGOLAKE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_CONGOLAKE = (stack, ctx) -> {
EntityPlayer player = ctx.player; EntityPlayer player = ctx.player;
if(player.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack); boolean aiming = ItemGunBaseNT.getIsAiming(stack);
@ -424,6 +467,40 @@ public class Orchestras {
EntityPlayer player = ctx.player; EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.CYCLE && player.worldObj.isRemote) {
AudioWrapper runningAudio = ItemGunBaseNT.loopedSounds.get(player);
if(timer < 5) {
//start sound
if(runningAudio == null || !runningAudio.isPlaying()) {
AudioWrapper audio = MainRegistry.proxy.getLoopedSound("hbm:weapon.fire.flameLoop", (float) player.posX, (float) player.posY, (float) player.posZ, 1F, 15F, 1F, 10);
ItemGunBaseNT.loopedSounds.put(player, audio);
audio.startSound();
}
//keepalive
if(runningAudio != null && runningAudio.isPlaying()) {
runningAudio.keepAlive();
runningAudio.updatePosition((float) player.posX, (float) player.posY, (float) player.posZ);
}
} else {
//stop sound due to timeout
if(runningAudio != null && runningAudio.isPlaying()) runningAudio.stopSound();
}
}
//stop sound due to state change
if(type != AnimType.CYCLE && player.worldObj.isRemote) {
AudioWrapper runningAudio = ItemGunBaseNT.loopedSounds.get(player);
if(runningAudio != null && runningAudio.isPlaying()) runningAudio.stopSound();
}
if(player.worldObj.isRemote) return;
if(type == AnimType.RELOAD) {
if(timer == 15) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.openLatch", 1F, 1F);
if(timer == 35) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.impact", 0.5F, 1F);
if(timer == 60) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 0.75F);
if(timer == 70) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.insertCanister", 1F, 1F);
if(timer == 85) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.pressureValve", 1F, 1F);
}
}; };
} }

View File

@ -3,6 +3,7 @@ package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import com.hbm.config.ClientConfig;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.BulletConfig; import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.Crosshair; import com.hbm.items.weapon.sedna.Crosshair;
@ -13,6 +14,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
@ -43,7 +45,7 @@ public class XFactory22lr {
ModItems.gun_am180 = new ItemGunBaseNT(new GunConfig() ModItems.gun_am180 = new ItemGunBaseNT(new GunConfig()
.dura(177 * 25).draw(15).inspect(38).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE) .dura(177 * 25).draw(15).inspect(38).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
.dmg(5F).delay(1).dry(10).auto(true).spread(0.02F).reload(53).jam(55).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F) .dmg(5F).delay(1).dry(10).auto(true).spread(0.02F).reload(66).jam(30).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 177).addConfigs(p22_sp, p22_fmj, p22_jhp, p22_ap)) .mag(new MagazineFullReload(0, 177).addConfigs(p22_sp, p22_fmj, p22_jhp, p22_ap))
.offset(1, -0.0625 * 1.5, -0.1875D) .offset(1, -0.0625 * 1.5, -0.1875D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL)) .canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
@ -57,27 +59,39 @@ public class XFactory22lr {
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_AM180_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_AM180_ANIMS = (stack, type) -> {
switch(type) { if(ClientConfig.GUN_ANIMS_LEGACY.get()) {
case EQUIP: return new BusAnimation() switch(type) {
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL)); case EQUIP: return new BusAnimation()
case CYCLE: return new BusAnimation() .addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL));
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, ItemGunBaseNT.getIsAiming(stack) ? -0.125 : -0.25, 15, IType.SIN_DOWN).addPos(0, 0, 0, 35, IType.SIN_FULL)); case CYCLE: return new BusAnimation()
case CYCLE_DRY: return new BusAnimation() .addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, ItemGunBaseNT.getIsAiming(stack) ? -0.125 : -0.25, 15, IType.SIN_DOWN).addPos(0, 0, 0, 35, IType.SIN_FULL));
.addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 550).addPos(0, 0, -1.5, 100, IType.SIN_UP).addPos(0, 0, 0, 100, IType.SIN_UP)) case CYCLE_DRY: return new BusAnimation()
.addBus("TURN", new BusAnimationSequence().addPos(0, 0, 0, 300).addPos(0, 0, 15, 250, IType.SIN_FULL).addPos(0, 0, 15, 400).addPos(0, 0, 0, 250, IType.SIN_FULL)); .addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 550).addPos(0, 0, -1.5, 100, IType.SIN_UP).addPos(0, 0, 0, 100, IType.SIN_UP))
case RELOAD: .addBus("TURN", new BusAnimationSequence().addPos(0, 0, 0, 300).addPos(0, 0, 15, 250, IType.SIN_FULL).addPos(0, 0, 15, 400).addPos(0, 0, 0, 250, IType.SIN_FULL));
return new BusAnimation() case RELOAD:
.addBus("MAGTURN", new BusAnimationSequence().addPos(15, 0, 0, 250, IType.SIN_FULL).addPos(15, 0, 0, 250).addPos(15, 0, 70, 300, IType.SIN_FULL).addPos(15, 0, 0, 0).addPos(15, 0, 0, 750).addPos(0, 0, 0, 250, IType.SIN_FULL)) return new BusAnimation()
.addBus("MAG", new BusAnimationSequence().addPos(0, 0, 0, 250).addPos(2, 0, -4, 250, IType.SIN_FULL).addPos(-10, 2, -4, 300, IType.SIN_UP).addPos(3, -6, -4, 0).addPos(2, 0, -4, 500, IType.SIN_FULL).addPos(0, 0, 0, 250, IType.SIN_FULL)) .addBus("MAGTURN", new BusAnimationSequence().addPos(15, 0, 0, 250, IType.SIN_FULL).addPos(15, 0, 0, 250).addPos(15, 0, 70, 300, IType.SIN_FULL).addPos(15, 0, 0, 0).addPos(15, 0, 0, 750).addPos(0, 0, 0, 250, IType.SIN_FULL))
.addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 2250).addPos(0, 0, -1.5, 100, IType.SIN_UP).addPos(0, 0, 0, 100, IType.SIN_UP)) .addBus("MAG", new BusAnimationSequence().addPos(0, 0, 0, 250).addPos(2, 0, -4, 250, IType.SIN_FULL).addPos(-10, 2, -4, 300, IType.SIN_UP).addPos(3, -6, -4, 0).addPos(2, 0, -4, 500, IType.SIN_FULL).addPos(0, 0, 0, 250, IType.SIN_FULL))
.addBus("TURN", new BusAnimationSequence().addPos(0, 0, 0, 2000).addPos(0, 0, 15, 250, IType.SIN_FULL).addPos(0, 0, 15, 400).addPos(0, 0, 0, 250, IType.SIN_FULL)); .addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 2250).addPos(0, 0, -1.5, 100, IType.SIN_UP).addPos(0, 0, 0, 100, IType.SIN_UP))
case JAMMED: return new BusAnimation() .addBus("TURN", new BusAnimationSequence().addPos(0, 0, 0, 2000).addPos(0, 0, 15, 250, IType.SIN_FULL).addPos(0, 0, 15, 400).addPos(0, 0, 0, 250, IType.SIN_FULL));
.addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 750).addPos(0, 0, -1.5, 100, IType.SIN_UP).addPos(0, 0, 0, 100, IType.SIN_UP)) case JAMMED: return new BusAnimation()
.addBus("TURN", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, 45, 250, IType.SIN_FULL).addPos(0, 0, 45, 400).addPos(0, 0, 0, 250, IType.SIN_FULL)); .addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 750).addPos(0, 0, -1.5, 100, IType.SIN_UP).addPos(0, 0, 0, 100, IType.SIN_UP))
case INSPECT: return new BusAnimation() .addBus("TURN", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, 45, 250, IType.SIN_FULL).addPos(0, 0, 45, 400).addPos(0, 0, 0, 250, IType.SIN_FULL));
.addBus("MAGTURN", new BusAnimationSequence().addPos(15, 0, 0, 250, IType.SIN_FULL).addPos(15, 0, 0, 1400).addPos(0, 0, 0, 250, IType.SIN_FULL)) case INSPECT: return new BusAnimation()
.addBus("MAG", new BusAnimationSequence().addPos(0, 0, 0, 200).addPos(4, -1, -4, 200, IType.SIN_FULL).addPos(4, -1.5, -4, 50).addPos(4, 0, -4, 100).addPos(4, 6, -4, 250, IType.SIN_DOWN).addPos(4, 0, -4, 150, IType.SIN_UP).addPos(4, -1, -4, 100, IType.SIN_DOWN).addPos(4, -1, -4, 250).addPos(0, 0, 0, 250, IType.SIN_FULL)) .addBus("MAGTURN", new BusAnimationSequence().addPos(15, 0, 0, 250, IType.SIN_FULL).addPos(15, 0, 0, 1400).addPos(0, 0, 0, 250, IType.SIN_FULL))
.addBus("MAGSPIN", new BusAnimationSequence().addPos(0, 0, 0, 600).addPos(-400, 0, 0, 500, IType.SIN_FULL).addPos(-400, 0, 0, 250).addPos(-360, 0, 0, 250)); .addBus("MAG", new BusAnimationSequence().addPos(0, 0, 0, 200).addPos(4, -1, -4, 200, IType.SIN_FULL).addPos(4, -1.5, -4, 50).addPos(4, 0, -4, 100).addPos(4, 6, -4, 250, IType.SIN_DOWN).addPos(4, 0, -4, 150, IType.SIN_UP).addPos(4, -1, -4, 100, IType.SIN_DOWN).addPos(4, -1, -4, 250).addPos(0, 0, 0, 250, IType.SIN_FULL))
.addBus("MAGSPIN", new BusAnimationSequence().addPos(0, 0, 0, 600).addPos(-400, 0, 0, 500, IType.SIN_FULL).addPos(-400, 0, 0, 250).addPos(-360, 0, 0, 250));
}
} else {
switch(type) {
case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL));
case CYCLE: return ResourceManager.am180_anim.get("Fire");
case CYCLE_DRY: return ResourceManager.am180_anim.get("FireDry");
case RELOAD: return ResourceManager.am180_anim.get("Reload");
case JAMMED: return ResourceManager.am180_anim.get("Jammed");
case INSPECT: return ResourceManager.am180_anim.get("Inspect");
}
} }
return null; return null;

View File

@ -11,30 +11,39 @@ import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.particle.helper.FlameCreator; import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType; import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class XFactoryFlamer { public class XFactoryFlamer {
public static BulletConfig flame_diesel; public static BulletConfig flame_diesel;
public static void init() { public static void init() {
flame_diesel = new BulletConfig().setItem(EnumAmmo.FLAME_DIESEL).setLife(100).setVel(1F).setGrav(0.02D).setReloadCount(200) flame_diesel = new BulletConfig().setItem(EnumAmmo.FLAME_DIESEL).setLife(100).setVel(1F).setGrav(0.02D).setReloadCount(300)
.setOnUpdate((bullet) -> { .setOnUpdate((bullet) -> {
if(!bullet.worldObj.isRemote) FlameCreator.composeEffect(bullet.worldObj, bullet.posX, bullet.posY - 0.25, bullet.posZ); if(bullet.worldObj.isRemote && MainRegistry.proxy.me().getDistanceToEntity(bullet) < 100) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "flamethrower");
data.setDouble("posX", bullet.posX);
data.setDouble("posY", bullet.posY - 0.125);
data.setDouble("posZ", bullet.posZ);
MainRegistry.proxy.effectNT(data);
}
}); });
ModItems.gun_flamer = new ItemGunBaseNT(new GunConfig() ModItems.gun_flamer = new ItemGunBaseNT(new GunConfig()
.dura(20_000).draw(4).inspect(23).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) .dura(20_000).draw(10).inspect(17).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
.dmg(10F).delay(1).auto(true).reload(55).jam(0) .dmg(10F).delay(1).auto(true).reload(90).jam(0)
.mag(new MagazineFullReload(0, 200).addConfigs(flame_diesel)) .mag(new MagazineFullReload(0, 300).addConfigs(flame_diesel))
.offset(0.75, -0.0625, -0.3125D) .offset(0.75, -0.0625, -0.25D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL)) .canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration() .setupStandardConfiguration()
.anim(LAMBDA_FLAMER_ANIMS).orchestra(Orchestras.ORCHESTRA_FLAMER) .anim(LAMBDA_FLAMER_ANIMS).orchestra(Orchestras.ORCHESTRA_FLAMER)
@ -44,9 +53,10 @@ public class XFactoryFlamer {
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_FLAMER_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_FLAMER_ANIMS = (stack, type) -> {
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-90, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(-45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN));
case RELOAD: return new BusAnimation(); case RELOAD: return ResourceManager.flamethrower_anim.get("Reload");
case INSPECT: return new BusAnimation(); case INSPECT: return new BusAnimation()
.addBus("ROTATE", new BusAnimationSequence().addPos(0, 0, 45, 250, IType.SIN_FULL).addPos(0, 0, 45, 350).addPos(0, 0, -15, 150, IType.SIN_FULL).addPos(0, 0, 0, 100, IType.SIN_FULL));
case JAMMED: return new BusAnimation(); case JAMMED: return new BusAnimation();
} }

View File

@ -5,6 +5,7 @@ import org.lwjgl.opengl.GL12;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.lib.RefStrings;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.ScaledResolution;
@ -12,27 +13,35 @@ import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
public class HUDComponentAmmoCounter implements IHUDComponent { public class HUDComponentAmmoCounter implements IHUDComponent {
private static final ResourceLocation misc = new ResourceLocation(RefStrings.MODID + ":textures/misc/overlay_misc.png");
protected static final RenderItem itemRenderer = RenderItem.getInstance(); protected static final RenderItem itemRenderer = RenderItem.getInstance();
protected int receiver; protected int receiver;
protected boolean mirrored; protected boolean mirrored;
protected boolean noCounter;
public HUDComponentAmmoCounter(int receiver) { public HUDComponentAmmoCounter(int receiver) {
this(receiver, false); this.receiver = receiver;
} }
public HUDComponentAmmoCounter(int receiver, boolean mirror) { public HUDComponentAmmoCounter mirror() {
this.receiver = receiver; this.mirrored = true;
this.mirrored = mirror; return this;
}
public HUDComponentAmmoCounter noCounter() {
this.noCounter = true;
return this;
} }
@Override @Override
public int getComponentHeight(EntityPlayer player, ItemStack stack){ public int getComponentHeight(EntityPlayer player, ItemStack stack){
return 22; return 24;
} }
@Override @Override
@ -41,12 +50,12 @@ public class HUDComponentAmmoCounter implements IHUDComponent {
ScaledResolution resolution = event.resolution; ScaledResolution resolution = event.resolution;
Minecraft mc = Minecraft.getMinecraft(); Minecraft mc = Minecraft.getMinecraft();
int pX = resolution.getScaledWidth() / 2 + (mirrored ? -(62 + 36 + 52) : (62 + 36)); int pX = resolution.getScaledWidth() / 2 + (mirrored ? -(62 + 36 + 52) : (62 + 36)) + (noCounter ? 14 : 0);
int pZ = resolution.getScaledHeight() - bottomOffset - 21; int pZ = resolution.getScaledHeight() - bottomOffset - 23;
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
IMagazine mag = gun.getConfig(stack, gunIndex).getReceivers(stack)[this.receiver].getMagazine(stack); IMagazine mag = gun.getConfig(stack, gunIndex).getReceivers(stack)[this.receiver].getMagazine(stack);
mc.fontRenderer.drawString(mag.reportAmmoStateForHUD(stack), pX + 17, pZ + 6, 0xFFFFFF); if(!noCounter) mc.fontRenderer.drawString(mag.reportAmmoStateForHUD(stack), pX + 17, pZ + 6, 0xFFFFFF);
GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL12.GL_RESCALE_NORMAL);
@ -55,5 +64,6 @@ public class HUDComponentAmmoCounter implements IHUDComponent {
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL12.GL_RESCALE_NORMAL);
mc.renderEngine.bindTexture(misc);
} }
} }

View File

@ -980,14 +980,6 @@ public class ClientProxy extends ServerProxy {
} }
} }
public static HashMap<String, IParticleCreator> particleCreators = new HashMap();
static {
particleCreators.put("explosionLarge", new ExplosionCreator());
particleCreators.put("casingNT", new CasingCreator());
particleCreators.put("flamethrower", new FlameCreator());
}
//mk3, only use this one //mk3, only use this one
@Override @Override
public void effectNT(NBTTagCompound data) { public void effectNT(NBTTagCompound data) {
@ -1006,8 +998,8 @@ public class ClientProxy extends ServerProxy {
double y = data.getDouble("posY"); double y = data.getDouble("posY");
double z = data.getDouble("posZ"); double z = data.getDouble("posZ");
if(particleCreators.containsKey(type)) { if(ParticleCreators.particleCreators.containsKey(type)) {
particleCreators.get(type).makeParticle(world, player, man, rand, x, y, z, data); ParticleCreators.particleCreators.get(type).makeParticle(world, player, man, rand, x, y, z, data);
return; return;
} }

View File

@ -868,6 +868,8 @@ public class ResourceManager {
public static final HashMap<String, BusAnimation> supershotty_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/supershotty.json")); public static final HashMap<String, BusAnimation> supershotty_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/supershotty.json"));
public static final HashMap<String, BusAnimation> benelli_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/benelli.json")); public static final HashMap<String, BusAnimation> benelli_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/benelli.json"));
public static final HashMap<String, BusAnimation> congolake_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/congolake.json")); public static final HashMap<String, BusAnimation> congolake_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/congolake.json"));
public static final HashMap<String, BusAnimation> am180_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/am180.json"));
public static final HashMap<String, BusAnimation> flamethrower_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/flamethrower.json"));
public static final IModelCustom lance = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/lance.obj")); public static final IModelCustom lance = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/lance.obj"));

View File

@ -4,6 +4,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -41,6 +42,11 @@ public class EntityFXRotating extends EntityFX {
double nX = ((y2 - y1) * (z3 - z1)) - ((z2 - z1) * (y3 - y1)); double nX = ((y2 - y1) * (z3 - z1)) - ((z2 - z1) * (y3 - y1));
double nY = ((z2 - z1) * (x3 - x1)) - ((x2 - x1) * (z3 - z1)); double nY = ((z2 - z1) * (x3 - x1)) - ((x2 - x1) * (z3 - z1));
double nZ = ((x2 - x1) * (y3 - y1)) - ((y2 - y1) * (x3 - x1)); double nZ = ((x2 - x1) * (y3 - y1)) - ((y2 - y1) * (x3 - x1));
Vec3 vec = Vec3.createVectorHelper(nX, nY, nZ).normalize();
nX = vec.xCoord;
nY = vec.yCoord;
nZ = vec.zCoord;
double cosTh = Math.cos(rotation * Math.PI / 180D); double cosTh = Math.cos(rotation * Math.PI / 180D);
double sinTh = Math.sin(rotation * Math.PI / 180D); double sinTh = Math.sin(rotation * Math.PI / 180D);

View File

@ -0,0 +1,80 @@
package com.hbm.particle;
import java.awt.Color;
import com.hbm.main.ModEventHandlerClient;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
@SideOnly(Side.CLIENT)
public class ParticleExplosionSmall extends EntityFXRotating {
public float hue;
public ParticleExplosionSmall(World world, double x, double y, double z, float scale, float speedMult) {
super(world, x, y, z);
particleIcon = ModEventHandlerClient.particleBase;
this.particleMaxAge = 25 + rand.nextInt(10);
this.particleScale = scale * 0.9F + rand.nextFloat() * 0.2F;
this.motionX = world.rand.nextGaussian() * speedMult;
this.motionZ = world.rand.nextGaussian() * speedMult;
this.particleGravity = rand.nextFloat() * -0.01F;
this.hue = 20F + rand.nextFloat() * 20F;
Color color = Color.getHSBColor(hue / 255F, 1F, 1F);
this.particleRed = color.getRed() / 255F;
this.particleGreen = color.getGreen() / 255F;
this.particleBlue = color.getBlue() / 255F;
this.noClip = true;
}
@Override
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.particleAge++;
if(this.particleAge >= this.particleMaxAge) {
this.setDead();
}
this.motionY -= particleGravity;
this.prevRotationPitch = this.rotationPitch;
float ageScaled = (float) this.particleAge / (float) this.particleMaxAge;
this.rotationPitch += (1 - ageScaled) * 5 * ((this.getEntityId() % 2) - 0.5);
this.motionX *= 0.65D;
this.motionZ *= 0.65D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
}
@Override
public void renderParticle(Tessellator tess, float interp, float sX, float sY, float sZ, float dX, float dZ) {
double ageScaled = (double) (this.particleAge + interp) / (double) this.particleMaxAge;
Color color = Color.getHSBColor(hue / 255F, Math.max(1F - (float) ageScaled * 2F, 0), MathHelper.clamp_float(1.25F - (float) ageScaled * 2F, hue * 0.01F - 0.1F, 1F));
this.particleRed = color.getRed() / 255F;
this.particleGreen = color.getGreen() / 255F;
this.particleBlue = color.getBlue() / 255F;
this.particleAlpha = (float) Math.pow(1 - Math.min(ageScaled, 1), 0.25);
tess.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha * 0.5F);
tess.setNormal(0.0F, 1.0F, 0.0F);
double scale = (0.25 + 1 - Math.pow(1 - ageScaled, 4) + (this.particleAge + interp) * 0.02) * this.particleScale;
renderParticleRotated(tess, interp, sX, sY, sZ, dX, dZ, scale);
}
}

View File

@ -62,7 +62,7 @@ public class ParticleFlamethrower extends EntityFXRotating {
tess.setNormal(0.0F, 1.0F, 0.0F); tess.setNormal(0.0F, 1.0F, 0.0F);
tess.setBrightness(240); tess.setBrightness(240);
double scale = (ageScaled * 0.75 + 0.5) * particleScale; double scale = (ageScaled * 1.25 + 0.25) * particleScale;
renderParticleRotated(tess, interp, sX, sY, sZ, dX, dZ, scale); renderParticleRotated(tess, interp, sX, sY, sZ, dX, dZ, scale);
} }

View File

@ -0,0 +1,61 @@
package com.hbm.particle.helper;
import java.util.Random;
import com.hbm.particle.ParticleExplosionSmall;
import cpw.mods.fml.relauncher.ReflectionHelper;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityBlockDustFX;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class ExplosionSmallCreator implements IParticleCreator {
public static void composeEffect(World world, double x, double y, double z, int cloudCount, float cloudScale, float cloudSpeedMult) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "explosionSmall");
data.setInteger("cloudCount", cloudCount);
data.setFloat("cloudScale", cloudScale);
data.setFloat("cloudSpeedMult", cloudSpeedMult);
data.setInteger("debris", 15);
IParticleCreator.sendPacket(world, x, y, z, 150, data);
}
@Override
public void makeParticle(World world, EntityPlayer player, TextureManager texman, Random rand, double x, double y, double z, NBTTagCompound data) {
int cloudCount = data.getInteger("cloudCount");
float cloudScale = data.getFloat("cloudScale");
float cloudSpeedMult = data.getFloat("cloudSpeedMult");
int debris = data.getInteger("debris");
for(int i = 0; i < cloudCount; i++) {
ParticleExplosionSmall particle = new ParticleExplosionSmall(world, x, y, z, cloudScale, cloudSpeedMult);
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
}
Block b = Blocks.air;
int meta = 0;
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
b = world.getBlock((int) Math.floor(x) + dir.offsetX, (int) Math.floor(y) + dir.offsetY, (int) Math.floor(z) + dir.offsetZ);
meta = world.getBlockMetadata((int) Math.floor(x) + dir.offsetX, (int) Math.floor(y) + dir.offsetY, (int) Math.floor(z) + dir.offsetZ);
if(b != Blocks.air) break;
}
if(b != Blocks.air) for(int i = 0; i < debris; i++) {
EntityBlockDustFX fx = new EntityBlockDustFX(world, x, y + 0.1, z, world.rand.nextGaussian() * 0.2, 0.5F + world.rand.nextDouble() * 0.7, world.rand.nextGaussian() * 0.2, b, meta);
fx.multipleParticleScaleBy(2);
ReflectionHelper.setPrivateValue(EntityFX.class, fx, 50 + rand.nextInt(20), "particleMaxAge", "field_70547_e");
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
}
}
}

View File

@ -0,0 +1,15 @@
package com.hbm.particle.helper;
import java.util.HashMap;
public class ParticleCreators {
public static HashMap<String, IParticleCreator> particleCreators = new HashMap();
static {
particleCreators.put("explosionLarge", new ExplosionCreator());
particleCreators.put("casingNT", new CasingCreator());
particleCreators.put("flamethrower", new FlameCreator());
particleCreators.put("explosionSmall", new ExplosionSmallCreator());
}
}

View File

@ -50,12 +50,18 @@ public class ItemRenderAm180 extends ItemRenderWeaponBase {
GL11.glTranslated(0, 0, recoil[2]); GL11.glTranslated(0, 0, recoil[2]);
HbmAnimations.applyRelevantTransformation("Gun");
ResourceManager.am180.renderPart("Gun"); ResourceManager.am180.renderPart("Gun");
ResourceManager.am180.renderPart("Silencer"); ResourceManager.am180.renderPart("Silencer");
GL11.glPushMatrix();
HbmAnimations.applyRelevantTransformation("Trigger");
ResourceManager.am180.renderPart("Trigger"); ResourceManager.am180.renderPart("Trigger");
GL11.glPopMatrix();
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslated(0, 0, bolt[2]); GL11.glTranslated(0, 0, bolt[2]);
HbmAnimations.applyRelevantTransformation("Bolt");
ResourceManager.am180.renderPart("Bolt"); ResourceManager.am180.renderPart("Bolt");
GL11.glPopMatrix(); GL11.glPopMatrix();
@ -70,6 +76,8 @@ public class ItemRenderAm180 extends ItemRenderWeaponBase {
GL11.glTranslated(0, 2.3125, 1.5); GL11.glTranslated(0, 2.3125, 1.5);
GL11.glRotated(magSpin[0], 1, 0, 0); GL11.glRotated(magSpin[0], 1, 0, 0);
GL11.glTranslated(0, -2.3125, -1.5); GL11.glTranslated(0, -2.3125, -1.5);
HbmAnimations.applyRelevantTransformation("Mag");
GL11.glPushMatrix(); GL11.glPushMatrix();
int mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack); int mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack);

View File

@ -34,16 +34,31 @@ public class ItemRenderFlamer extends ItemRenderWeaponBase {
GL11.glScaled(scale, scale, scale); GL11.glScaled(scale, scale, scale);
double[] equip = HbmAnimations.getRelevantTransformation("EQUIP"); double[] equip = HbmAnimations.getRelevantTransformation("EQUIP");
double[] rotate = HbmAnimations.getRelevantTransformation("ROTATE");
GL11.glTranslated(0, -1, -3); GL11.glTranslated(0, 2, -6);
GL11.glRotated(equip[0], 1, 0, 0); GL11.glRotated(-equip[0], 1, 0, 0);
GL11.glTranslated(0, 1, 3); GL11.glTranslated(0, -2, 6);
GL11.glTranslated(0, 1, 0);
GL11.glRotated(rotate[2], 0, 0, 1);
GL11.glTranslated(0, -1, 0);
GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glShadeModel(GL11.GL_SMOOTH);
ResourceManager.flamethrower.renderPart("Gun");
ResourceManager.flamethrower.renderPart("Tank");
GL11.glPushMatrix(); GL11.glPushMatrix();
HbmAnimations.applyRelevantTransformation("Gun");
ResourceManager.flamethrower.renderPart("Gun");
GL11.glPopMatrix();
GL11.glPushMatrix();
HbmAnimations.applyRelevantTransformation("Tank");
ResourceManager.flamethrower.renderPart("Tank");
GL11.glPopMatrix();
GL11.glPushMatrix();
HbmAnimations.applyRelevantTransformation("Gauge");
GL11.glTranslated(1.25, 1.25, 0); GL11.glTranslated(1.25, 1.25, 0);
IMagazine mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack); IMagazine mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack);
GL11.glRotated(-135 + (mag.getAmount(stack) * 270D / mag.getCapacity(stack)), 0, 0, 1); GL11.glRotated(-135 + (mag.getAmount(stack) * 270D / mag.getCapacity(stack)), 0, 0, 1);
@ -57,7 +72,9 @@ public class ItemRenderFlamer extends ItemRenderWeaponBase {
@Override @Override
public void setupThirdPerson(ItemStack stack) { public void setupThirdPerson(ItemStack stack) {
super.setupThirdPerson(stack); super.setupThirdPerson(stack);
GL11.glTranslated(0, 1, 3); double scale = 1.75D;
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(0, -3, 4);
} }

View File

@ -213,7 +213,7 @@ public abstract class ItemRenderWeaponBase implements IItemRenderer {
GL11.glRotatef(15.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(15.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(12.5F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(12.5F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(10.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(15.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(3.5, 0, 0); GL11.glTranslated(3.5, 0, 0);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -76,46 +76,46 @@ v -0.250000 -1.566988 -6.750000
vt 0.346821 0.604839 vt 0.346821 0.604839
vt 0.369942 0.580645 vt 0.369942 0.580645
vt 0.369942 0.612903 vt 0.369942 0.612903
vt 0.393064 0.741935 vt 0.390173 0.741935
vt 0.369942 0.709677 vt 0.369942 0.709677
vt 0.393064 0.709677 vt 0.390173 0.709677
vt 0.624277 0.709677 vt 0.624277 0.709677
vt 0.624277 0.741935 vt 0.624277 0.741935
vt 0.369942 0.645161 vt 0.369942 0.645161
vt 0.346821 0.620968 vt 0.346821 0.620968
vt 0.393064 0.774194 vt 0.390173 0.774194
vt 0.369942 0.806452 vt 0.369942 0.806452
vt 0.369942 0.774194 vt 0.369942 0.774194
vt 0.624277 0.677419 vt 0.624277 0.677419
vt 0.367052 0.935484 vt 0.369942 0.935484
vt 0.346821 0.911290 vt 0.346821 0.911290
vt 0.369942 0.903226 vt 0.369942 0.903226
vt 0.369942 0.741935 vt 0.369942 0.741935
vt 0.393064 0.677419 vt 0.390173 0.677419
vt 0.624277 0.645161 vt 0.624277 0.645161
vt 0.346821 0.895161 vt 0.346821 0.895161
vt 0.369942 0.870968 vt 0.369942 0.870968
vt 0.369942 0.677419 vt 0.369942 0.677419
vt 0.393064 0.645161 vt 0.390173 0.645161
vt 0.624277 0.612903 vt 0.624277 0.612903
vt 0.346821 0.862903 vt 0.346821 0.862903
vt 0.369942 0.838710 vt 0.369942 0.838710
vt 0.393064 0.612903 vt 0.390173 0.612903
vt 0.624277 0.580645 vt 0.624277 0.580645
vt 0.346821 0.814516 vt 0.346821 0.814516
vt 0.393064 0.580645 vt 0.390173 0.580645
vt 0.369942 0.548387 vt 0.369942 0.548387
vt 0.393064 0.548387 vt 0.390173 0.548387
vt 0.624277 0.548387 vt 0.624277 0.548387
vt 0.346821 0.782258 vt 0.346821 0.782258
vt 0.393064 0.903226 vt 0.390173 0.903226
vt 0.393064 0.870968 vt 0.390173 0.870968
vt 0.393064 0.935484 vt 0.390173 0.935484
vt 0.624277 0.903226 vt 0.624277 0.903226
vt 0.624277 0.935484 vt 0.624277 0.935484
vt 0.346821 0.750000 vt 0.346821 0.750000
vt 0.393064 0.838710 vt 0.390173 0.838710
vt 0.393064 0.806452 vt 0.390173 0.806452
vt 0.624277 0.870968 vt 0.624277 0.870968
vt 0.346821 0.733871 vt 0.346821 0.733871
vt 0.624277 0.838710 vt 0.624277 0.838710

View File

@ -223,6 +223,7 @@
"weapon.switchmode2": {"category": "player", "sounds": [{"name": "weapon/switchmode2", "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.fire.blackPowder": {"category": "player", "sounds": [{"name": "weapon/fire/blackPowder", "stream": false}]},
"weapon.fire.flameLoop": {"category": "player", "sounds": [{"name": "weapon/fire/flameLoop", "stream": false}]},
"weapon.reload.boltClose": {"category": "player", "sounds": ["weapon/reload/boltClose"]}, "weapon.reload.boltClose": {"category": "player", "sounds": ["weapon/reload/boltClose"]},
"weapon.reload.boltOpen": {"category": "player", "sounds": ["weapon/reload/boltOpen"]}, "weapon.reload.boltOpen": {"category": "player", "sounds": ["weapon/reload/boltOpen"]},