bullet factories, itemgunbase

This commit is contained in:
Bob 2023-01-26 22:50:45 +01:00
parent 4d9209a407
commit 3376792c41
27 changed files with 596 additions and 772 deletions

View File

@ -0,0 +1,18 @@
package com.hbm.entity.projectile;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.World;
public class EntityCombineBallNT extends EntityBulletBase {
public EntityCombineBallNT(World world, int config, EntityLivingBase shooter) {
super(world, config, shooter);
overrideDamage = 1000;
}
@Override
public void setDead() {
super.setDead();
worldObj.createExplosion(shooter, posX, posY, posZ, 2, false);
}
}

View File

@ -3,7 +3,6 @@ package com.hbm.handler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.render.anim.BusAnimation;

View File

@ -5,7 +5,10 @@ import java.util.ArrayList;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmCollection;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
public class Gun5mmFactory {
@ -27,12 +30,7 @@ public class Gun5mmFactory {
config.durability = 10000;
config.firingSound = "hbm:weapon.lacunaeShoot";
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.R5_NORMAL);
config.config.add(BulletConfigSyncingUtil.R5_EXPLOSIVE);
config.config.add(BulletConfigSyncingUtil.R5_DU);
config.config.add(BulletConfigSyncingUtil.R5_STAR);
config.config.add(BulletConfigSyncingUtil.CHL_R5);
config.config = HbmCollection.fiveMM;
return config;
}
@ -41,8 +39,8 @@ public class Gun5mmFactory {
GunConfiguration config = getMinigunConfig();
config.name = "CZ53 Personal Minigun";
config.manufacturer = "Rockwell International Corporation";
config.name = "cz53";
config.manufacturer = EnumGunManufacturer.ROCKWELL;
return config;
}
@ -52,8 +50,8 @@ public class Gun5mmFactory {
GunConfiguration config = getMinigunConfig();
config.durability = 15000;
config.name = "CZ57 Avenger Minigun";
config.manufacturer = "Rockwell International Corporation";
config.name = "cz57";
config.manufacturer = EnumGunManufacturer.ROCKWELL;
return config;
}
@ -63,8 +61,8 @@ public class Gun5mmFactory {
GunConfiguration config = getMinigunConfig();
config.durability = 25000;
config.name = "Auntie Lacunae";
config.manufacturer = "Rockwell International Corporation?";
config.name = "lacunae";
config.manufacturer = EnumGunManufacturer.ROCKWELL_U;
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.R5_NORMAL_BOLT);
@ -76,12 +74,13 @@ public class Gun5mmFactory {
return config;
}
static float inaccuracy = 10;
private static float inaccuracy = 10;
private static byte i = 0;
public static BulletConfiguration get5mmConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.ammo_5mm;
bullet.ammo = new ComparableStack(ModItems.ammo_5mm, 1, i++);
bullet.spread *= inaccuracy;
bullet.dmgMin = 12;
bullet.dmgMax = 14;
@ -93,7 +92,7 @@ public class Gun5mmFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.ammo_5mm_explosive;
bullet.ammo = new ComparableStack(ModItems.ammo_5mm, 1, i++);
bullet.spread *= inaccuracy;
bullet.dmgMin = 30;
bullet.dmgMax = 32;
@ -107,7 +106,7 @@ public class Gun5mmFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.ammo_5mm_du;
bullet.ammo = new ComparableStack(ModItems.ammo_5mm, 1, i++);
bullet.spread *= inaccuracy;
bullet.dmgMin = 36;
bullet.dmgMax = 40;
@ -121,7 +120,7 @@ public class Gun5mmFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.ammo_5mm_star;
bullet.ammo = new ComparableStack(ModItems.ammo_5mm, 1, i++);
bullet.spread *= inaccuracy;
bullet.dmgMin = 46;
bullet.dmgMax = 50;

View File

@ -3,12 +3,14 @@ package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletHurtBehavior;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmCollection;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.lib.ModDamageSource;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
@ -72,23 +74,21 @@ public class Gun75BoltFactory {
)
);
config.name = "Manticora Pattern Boltgun";
config.manufacturer = "Cerix Magnus";
config.config = new ArrayList();
config.config.add(BulletConfigSyncingUtil.B75_NORMAL);
config.config.add(BulletConfigSyncingUtil.B75_INCENDIARY);
config.config.add(BulletConfigSyncingUtil.B75_HE);
config.name = "bolter";
config.manufacturer = EnumGunManufacturer.CERIX;
config.config = HbmCollection.seventyFive;
return config;
}
static float inaccuracy = 0.5F;
private static float inaccuracy = 0.5F;
private static byte i = 0;
public static BulletConfiguration get75BoltConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.ammo_75bolt;
bullet.ammo = new ComparableStack(ModItems.ammo_75bolt, 1, i++);
bullet.ammoCount = 30;
bullet.spread *= inaccuracy;
bullet.dmgMin = 74;
@ -126,7 +126,7 @@ public class Gun75BoltFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.ammo_75bolt_incendiary;
bullet.ammo = new ComparableStack(ModItems.ammo_75bolt, 1, i++);
bullet.ammoCount = 30;
bullet.spread *= inaccuracy;
bullet.dmgMin = 72;
@ -164,7 +164,7 @@ public class Gun75BoltFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.ammo_75bolt_he;
bullet.ammo = new ComparableStack(ModItems.ammo_75bolt, 1, i++);
bullet.ammoCount = 30;
bullet.spread *= inaccuracy;
bullet.dmgMin = 94;

View File

@ -0,0 +1,164 @@
package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmCollection;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.potion.HbmPotion;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import net.minecraft.potion.PotionEffect;
public class Gun762mmFactory {
public static GunConfiguration getUACDMRConfig() {
final GunConfiguration config = new GunConfiguration();
config.rateOfFire = 4;
config.roundsPerCycle = 1;
config.gunMode = GunConfiguration.MODE_NORMAL;
config.firingMode = GunConfiguration.FIRE_AUTO;
config.reloadDuration = 30;
config.firingDuration = 8;
config.ammoCap = 30;
config.durability = 30000;
config.reloadType = 1;
config.allowsInfinity = true;
config.hasSights = true;
config.crosshair = Crosshair.CROSS;
config.reloadSound = "hbm:weapon.DMRMagInPB3";
config.firingSound = "hbm:weapon.DMRShootPB3Alt";
config.reloadSoundEnd = true;
config.name = "uacDMR";
config.manufacturer = EnumGunManufacturer.UAC;
config.config.addAll(HbmCollection.threeZeroEight);
return config;
}
public static GunConfiguration getUACCarbineConfig() {
final GunConfiguration config = getUACDMRConfig();
config.rateOfFire = 2;
config.reloadDuration = 20;
config.ammoCap = 40;
config.durability = 40000;
config.crosshair = Crosshair.SPLIT;
config.reloadSound = "hbm:weapon.carbineMagInPB3";
config.firingSound = "hbm:weapon.carbineShootPB3";
config.name = "uacCarbine";
return config;
}
public static GunConfiguration getUACLMGConfig() {
final GunConfiguration config = getUACCarbineConfig();
config.ammoCap = 60;
config.durability = 50000;
config.crosshair = Crosshair.BOX;
config.reloadSound = "hbm:weapon.LMGMagInPB3";
config.firingSound = "hbm:weapon.LMGShootPB3Alt";
config.name = "uacLMG";
return config;
}
public static GunConfiguration getM60Config() {
final GunConfiguration config = new GunConfiguration();
config.rateOfFire = 2;
config.durability = 10000;
config.roundsPerCycle = 1;
config.firingMode = GunConfiguration.FIRE_AUTO;
config.reloadType = GunConfiguration.RELOAD_NONE;
config.ammoCap = 0;
config.allowsInfinity = true;
config.hasSights = true;
config.crosshair = Crosshair.L_BOX;
config.firingSound = "hbm:weapon.LMGShootPB3";
config.name = "m60";
config.manufacturer = EnumGunManufacturer.SACO;
config.comment.add("\"Get some!\"");
config.comment.add(" ~ Stuart Brown (aka Ahoy)");
config.config.addAll(HbmCollection.threeZeroEight);
return config;
}
public static BulletConfiguration get762NATOConfig() {
final BulletConfiguration bullet = Gun556mmFactory.get556Config().clone();
bullet.ammo = new ComparableStack(ModItems.ammo_308, 1, 0);
bullet.dmgMax *= 2;
bullet.dmgMin *= 2;
bullet.velocity *= 2.5;
bullet.maxAge *= 2;
bullet.spread /= 2;
return bullet;
}
public static BulletConfiguration get762APConfig() {
final BulletConfiguration bullet = get762NATOConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_308, 1, 1);
bullet.dmgMax *= 1.5;
bullet.dmgMin *= 1.5;
return bullet;
}
public static BulletConfiguration get762DUConfig() {
final BulletConfiguration bullet = get762NATOConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_308, 1, 2);
bullet.dmgMax *= 2;
bullet.dmgMin *= 2;
return bullet;
}
public static BulletConfiguration get762TracerConfig() {
final BulletConfiguration bullet = get762NATOConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_308, 1, 3);
bullet.vPFX = "reddust";
return bullet;
}
public static BulletConfiguration get762WPConfig() {
final BulletConfiguration bullet = get762NATOConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_308, 1, 4);
bullet.setToFire(20 * 5);
bullet.vPFX = "reddust";
final PotionEffect eff = new PotionEffect(HbmPotion.phosphorus.id, 20 * 20, 0, true);
eff.getCurativeItems().clear();
bullet.effects = new ArrayList<PotionEffect>();
bullet.effects.add(new PotionEffect(eff));
return bullet;
}
public static BulletConfiguration get762BlankConfig() {
final BulletConfiguration bullet = get762NATOConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_308, 1, 5);
bullet.dmgMax = 0;
bullet.dmgMin = 0;
bullet.maxAge = 0;
return bullet;
}
}

View File

@ -5,7 +5,9 @@ import java.util.ArrayList;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
public class Gun9mmFactory {
@ -29,8 +31,8 @@ public class Gun9mmFactory {
config.firingSound = "hbm:weapon.rifleShoot";
config.reloadSoundEnd = false;
config.name = "Maschinenpistole 40";
config.manufacturer = "Erfurter Maschinenfabrik Geipel";
config.name = "mp40";
config.manufacturer = EnumGunManufacturer.NAZI;
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.P9_NORMAL);
@ -61,8 +63,8 @@ public class Gun9mmFactory {
config.firingSound = "hbm:weapon.rifleShoot";
config.reloadSoundEnd = false;
config.name = "M1A1 Submachine Gun 9mm Mod";
config.manufacturer = "Auto-Ordnance Corporation";
config.name = "tommy9";
config.manufacturer = EnumGunManufacturer.AUTO_ORDINANCE;
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.P9_NORMAL);
@ -79,7 +81,7 @@ public class Gun9mmFactory {
BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig();
bullet.ammo = ModItems.ammo_9mm;
bullet.ammo = new ComparableStack(ModItems.ammo_9mm, 1, 0);
bullet.spread *= inaccuracy;
bullet.dmgMin = 10;
bullet.dmgMax = 14;
@ -91,7 +93,7 @@ public class Gun9mmFactory {
BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig();
bullet.ammo = ModItems.ammo_9mm_ap;
bullet.ammo = new ComparableStack(ModItems.ammo_9mm, 1, 1);
bullet.spread *= inaccuracy;
bullet.dmgMin = 18;
bullet.dmgMax = 20;
@ -105,7 +107,7 @@ public class Gun9mmFactory {
BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig();
bullet.ammo = ModItems.ammo_9mm_du;
bullet.ammo = new ComparableStack(ModItems.ammo_9mm, 1, 2);
bullet.spread *= inaccuracy;
bullet.dmgMin = 22;
bullet.dmgMax = 26;
@ -119,7 +121,7 @@ public class Gun9mmFactory {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_9mm_rocket;
bullet.ammo = new ComparableStack(ModItems.ammo_9mm, 1, 3);
bullet.velocity = 5;
bullet.explosive = 7.5F;
bullet.trail = 5;

View File

@ -3,15 +3,17 @@ package com.hbm.handler.guncfg;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.handler.BulletConfiguration;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
public class GunCannonFactory {
private static byte i = 0;
public static BulletConfiguration getShellConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardShellConfig();
bullet.ammo = ModItems.ammo_shell;
bullet.ammo = new ComparableStack(ModItems.ammo_shell, 1, i++);
bullet.dmgMin = 25;
bullet.dmgMax = 35;
bullet.explosive = 4F;
@ -24,7 +26,7 @@ public class GunCannonFactory {
BulletConfiguration bullet = BulletConfigFactory.standardShellConfig();
bullet.ammo = ModItems.ammo_shell_explosive;
bullet.ammo = new ComparableStack(ModItems.ammo_shell, 1, i++);
bullet.dmgMin = 35;
bullet.dmgMax = 45;
bullet.explosive = 4F;
@ -37,7 +39,7 @@ public class GunCannonFactory {
BulletConfiguration bullet = BulletConfigFactory.standardShellConfig();
bullet.ammo = ModItems.ammo_shell_apfsds_t;
bullet.ammo = new ComparableStack(ModItems.ammo_shell, 1, i++);
bullet.dmgMin = 50;
bullet.dmgMax = 55;
bullet.doesPenetrate = true;
@ -50,7 +52,7 @@ public class GunCannonFactory {
BulletConfiguration bullet = BulletConfigFactory.standardShellConfig();
bullet.ammo = ModItems.ammo_shell_apfsds_du;
bullet.ammo = new ComparableStack(ModItems.ammo_shell, 1, i++);
bullet.dmgMin = 70;
bullet.dmgMax = 80;
bullet.doesPenetrate = true;
@ -63,7 +65,7 @@ public class GunCannonFactory {
BulletConfiguration bullet = BulletConfigFactory.standardShellConfig();
bullet.ammo = ModItems.ammo_shell_w9;
bullet.ammo = new ComparableStack(ModItems.ammo_shell, 1, i++);
bullet.dmgMin = 100;
bullet.dmgMax = 150;

View File

@ -1,6 +1,7 @@
package com.hbm.handler.guncfg;
import com.hbm.handler.BulletConfiguration;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
public class GunDGKFactory {
@ -8,7 +9,7 @@ public class GunDGKFactory {
public static BulletConfiguration getDGKConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.ammo_dgk;
bullet.ammo = new ComparableStack(ModItems.ammo_dgk);
return bullet;
}

View File

@ -8,8 +8,10 @@ import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletHurtBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.ItemGunDart;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.main.MainRegistry;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
@ -42,8 +44,8 @@ public class GunDartFactory {
config.reloadSoundEnd = false;
config.showAmmo = true;
config.name = "Needle Gun";
config.manufacturer = "-";
config.name = "dart";
config.manufacturer = EnumGunManufacturer.NONE;
config.config = new ArrayList();
config.config.add(BulletConfigSyncingUtil.NEEDLE_GPS);
@ -73,8 +75,8 @@ public class GunDartFactory {
config.reloadSoundEnd = false;
config.showAmmo = true;
config.name = "NERF blaster of unknown design";
config.manufacturer = "Hasbro";
config.name = "nerf";
config.manufacturer = EnumGunManufacturer.HASBRO;
config.config = new ArrayList();
config.config.add(BulletConfigSyncingUtil.DART_NORMAL);
@ -87,7 +89,7 @@ public class GunDartFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.ammo_dart;
bullet.ammo = new ComparableStack(ModItems.ammo_dart, 1, 0);
bullet.velocity = 5.0F;
bullet.spread = 0;
bullet.dmgMin = 1;
@ -133,7 +135,7 @@ public class GunDartFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.ammo_dart_nuclear;
bullet.ammo = new ComparableStack(ModItems.ammo_dart, 1, 1);
bullet.velocity = 5.0F;
bullet.spread = 0;
bullet.dmgMin = 1;
@ -170,7 +172,7 @@ public class GunDartFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.ammo_dart_nerf;
bullet.ammo = new ComparableStack(ModItems.ammo_dart, 1, 2);
bullet.velocity = 1.0F;
bullet.gravity = 0.04D;
bullet.dmgMin = 0;

View File

@ -10,6 +10,8 @@ import com.hbm.interfaces.IBomb;
import com.hbm.interfaces.IBomb.BombReturnCode;
import com.hbm.main.MainRegistry;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.PlayerInformPacket;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
@ -44,8 +46,8 @@ public class GunDetonatorFactory {
config.reloadSoundEnd = false;
config.showAmmo = true;
config.name = "Hopeville Laser Detonator";
config.manufacturer = "WestTek";
config.name = "laserDet";
config.manufacturer = EnumGunManufacturer.WESTTEK;
config.config = new ArrayList();
config.config.add(BulletConfigSyncingUtil.DET_BOLT);
@ -79,7 +81,7 @@ public class GunDetonatorFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = Items.redstone;
bullet.ammo = new ComparableStack(Items.redstone);
bullet.spread = 0.0F;
bullet.maxAge = 100;
bullet.dmgMin = 0;

View File

@ -11,7 +11,9 @@ import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.lib.ModDamageSource;
import com.hbm.main.MainRegistry;
import com.hbm.packet.AuxParticlePacketNT;
@ -42,7 +44,7 @@ public class GunEnergyFactory {
config.crosshair = Crosshair.CIRCLE;
config.name = "Chemical Thrower";
config.manufacturer = "Langford Research Laboratories";
config.manufacturer = EnumGunManufacturer.LANGFORD;
config.config = new ArrayList<Integer>();
@ -67,7 +69,7 @@ public class GunEnergyFactory {
config.firingSound = "hbm:weapon.teslaShoot";
config.name = "EMP Orb Projector";
config.manufacturer = "MWT Prototype Labs";
config.manufacturer = EnumGunManufacturer.MWT;
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.SPECIAL_EMP);
@ -95,7 +97,7 @@ public class GunEnergyFactory {
config.reloadSound = "hbm:weapon.flamerReload";
config.name = "Heavy Duty Flamer";
config.manufacturer = "MWT Prototype Labs";
config.manufacturer = EnumGunManufacturer.MWT;
config.comment.add("Dragon-slaying: Advanced techniques, part 1:");
config.comment.add("Try not to get eaten by the dragon.");
@ -132,7 +134,7 @@ public class GunEnergyFactory {
config.reloadSound = "hbm:weapon.b92Reload";
config.name = "EMC101 Prismatic Negative Energy Cannon";
config.manufacturer = "MWT Prototype Labs";
config.manufacturer = EnumGunManufacturer.MWT;
config.comment.add("Taste the rainbow!");
@ -162,7 +164,7 @@ public class GunEnergyFactory {
config.reloadSound = "hbm:weapon.flamerReload";
config.name = "PROTEX Fire Exinguisher 6kg";
config.manufacturer = "Gloria GmbH";
config.manufacturer = EnumGunManufacturer.GLORIA;
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.FEXT_NORMAL);
@ -184,7 +186,7 @@ public class GunEnergyFactory {
BulletConfiguration bullet = new BulletConfiguration();
bullet.ammo = ModItems.gun_emp_ammo;
bullet.ammo = new ComparableStack(ModItems.gun_emp_ammo);
bullet.velocity = 1F;
bullet.spread = 0.0F;
@ -213,11 +215,12 @@ public class GunEnergyFactory {
return bullet;
}
private static byte i1 = 0;
public static BulletConfiguration getFlameConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.ammo = ModItems.ammo_fuel;
bullet.ammo = new ComparableStack(ModItems.ammo_fuel, 1, i1++);;
bullet.ammoCount = 100;
bullet.velocity = 0.75F;
@ -265,7 +268,7 @@ public class GunEnergyFactory {
BulletConfiguration bullet = getFlameConfig();
bullet.ammo = ModItems.ammo_fuel_napalm;
bullet.ammo = new ComparableStack(ModItems.ammo_fuel, 1, i1++);
bullet.wear = 2;
bullet.dmgMin = 4;
bullet.dmgMax = 6;
@ -278,7 +281,7 @@ public class GunEnergyFactory {
BulletConfiguration bullet = getFlameConfig();
bullet.ammo = ModItems.ammo_fuel_phosphorus;
bullet.ammo = new ComparableStack(ModItems.ammo_fuel, 1, i1++);
bullet.wear = 2;
bullet.spread = 0.0F;
bullet.bulletsMin = 1;
@ -297,7 +300,7 @@ public class GunEnergyFactory {
BulletConfiguration bullet = getFlameConfig();
bullet.ammo = ModItems.ammo_fuel_vaporizer;
bullet.ammo = new ComparableStack(ModItems.ammo_fuel, 1, i1++);
bullet.wear = 4;
bullet.spread = 0.25F;
bullet.bulletsMin = 8;
@ -322,7 +325,7 @@ public class GunEnergyFactory {
BulletConfiguration bullet = getFlameConfig();
bullet.ammo = ModItems.ammo_fuel_gas;
bullet.ammo = new ComparableStack(ModItems.ammo_fuel, 1, i1++);
bullet.wear = 1;
bullet.spread = 0.05F;
bullet.gravity = 0D;
@ -340,11 +343,12 @@ public class GunEnergyFactory {
return bullet;
}
private static byte i2 = 0;
public static BulletConfiguration getFextConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.ammo = ModItems.ammo_fireext;
bullet.ammo = new ComparableStack(ModItems.ammo_fireext, 1, i2++);
bullet.ammoCount = 300;
bullet.velocity = 0.75F;
@ -432,7 +436,7 @@ public class GunEnergyFactory {
BulletConfiguration bullet = getFextConfig();
bullet.ammo = ModItems.ammo_fireext_foam;
bullet.ammo = new ComparableStack(ModItems.ammo_fireext, 1, i2++);
bullet.spread = 0.05F;
bullet.bImpact = new IBulletImpactBehavior() {
@ -513,7 +517,7 @@ public class GunEnergyFactory {
BulletConfiguration bullet = getFextConfig();
bullet.ammo = ModItems.ammo_fireext_sand;
bullet.ammo = new ComparableStack(ModItems.ammo_fireext, 1, i2++);
bullet.spread = 0.1F;
bullet.bImpact = new IBulletImpactBehavior() {
@ -578,7 +582,7 @@ public class GunEnergyFactory {
BulletConfiguration bullet = new BulletConfiguration();
bullet.ammo = ModItems.nugget_euphemium;
bullet.ammo = new ComparableStack(ModItems.nugget_euphemium);
bullet.ammoCount = 1000;
bullet.wear = 1;
bullet.velocity = 1F;
@ -621,7 +625,7 @@ public class GunEnergyFactory {
BulletConfiguration bullet = new BulletConfiguration();
bullet.ammo = ModItems.nothing;
bullet.ammo = new ComparableStack(ModItems.nothing);
bullet.dmgMin = 100;
bullet.dmgMax = 150;
bullet.velocity = 1F;

View File

@ -13,7 +13,9 @@ import com.hbm.handler.GunConfiguration;
import com.hbm.handler.radiation.ChunkRadiationManager;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
@ -43,8 +45,8 @@ public class GunFatmanFactory {
config.reloadSound = GunConfiguration.RSOUND_FATMAN;
config.reloadSoundEnd = false;
config.name = "M-42 Tactical Nuclear Catapult";
config.manufacturer = "Fort Strong";
config.name = "m42";
config.manufacturer = EnumGunManufacturer.F_STRONG;
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.NUKE_NORMAL);
@ -63,8 +65,8 @@ public class GunFatmanFactory {
GunConfiguration config = getFatmanConfig();
config.name = "M-42 Experimental MIRV";
config.manufacturer = "Fort Strong";
config.name = "m42MIRV";
config.manufacturer = EnumGunManufacturer.F_STRONG;
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.NUKE_MIRV_NORMAL);
@ -81,8 +83,8 @@ public class GunFatmanFactory {
GunConfiguration config = getFatmanConfig();
config.name = "Balefire Egg Launcher";
config.manufacturer = "Fort Strong";
config.name = "bel";
config.manufacturer = EnumGunManufacturer.F_STRONG;
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.NUKE_AMAT);
@ -108,8 +110,8 @@ public class GunFatmanFactory {
config.reloadSound = GunConfiguration.RSOUND_FATMAN;
config.reloadSoundEnd = false;
config.name = "M-42 Tactical Nuclear Catapult";
config.manufacturer = "Fort Strong";
config.name = "m42";
config.manufacturer = EnumGunManufacturer.F_STRONG;
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.NUKE_PROTO_NORMAL);
@ -127,7 +129,7 @@ public class GunFatmanFactory {
public static BulletConfiguration getNukeConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig();
bullet.ammo = ModItems.ammo_nuke;
bullet.ammo = new ComparableStack(ModItems.ammo_nuke, 1, 0);
bullet.bImpact = new IBulletImpactBehavior() {
@ -143,7 +145,7 @@ public class GunFatmanFactory {
public static BulletConfiguration getNukeLowConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig();
bullet.ammo = ModItems.ammo_nuke_low;
bullet.ammo = new ComparableStack(ModItems.ammo_nuke, 1, 1);
bullet.bImpact = new IBulletImpactBehavior() {
@ -159,7 +161,7 @@ public class GunFatmanFactory {
public static BulletConfiguration getNukeHighConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig();
bullet.ammo = ModItems.ammo_nuke_high;
bullet.ammo = new ComparableStack(ModItems.ammo_nuke, 1, 2);
bullet.bImpact = new IBulletImpactBehavior() {
@ -175,7 +177,7 @@ public class GunFatmanFactory {
public static BulletConfiguration getNukeTotsConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig();
bullet.ammo = ModItems.ammo_nuke_tots;
bullet.ammo = new ComparableStack(ModItems.ammo_nuke, 1, 3);
bullet.bulletsMin = 8;
bullet.bulletsMax = 8;
bullet.spread = 0.1F;
@ -195,7 +197,7 @@ public class GunFatmanFactory {
public static BulletConfiguration getNukeSafeConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig();
bullet.ammo = ModItems.ammo_nuke_safe;
bullet.ammo = new ComparableStack(ModItems.ammo_nuke, 1, 4);
bullet.bImpact = new IBulletImpactBehavior() {
@ -211,7 +213,7 @@ public class GunFatmanFactory {
public static BulletConfiguration getNukePumpkinConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig();
bullet.ammo = ModItems.ammo_nuke_pumpkin;
bullet.ammo = new ComparableStack(ModItems.ammo_nuke, 1, 5);
bullet.explosive = 10F;
bullet.bImpact = new IBulletImpactBehavior() {
@ -242,7 +244,7 @@ public class GunFatmanFactory {
public static BulletConfiguration getNukeBarrelConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig();
bullet.ammo = ModItems.ammo_nuke_barrel;
bullet.ammo = new ComparableStack(ModItems.ammo_nuke, 1, 6);
bullet.explosive = 3F;
bullet.style = bullet.STYLE_BARREL;
@ -300,7 +302,7 @@ public class GunFatmanFactory {
BulletConfiguration bullet = getNukeConfig();
bullet.ammo = ModItems.ammo_mirv;
bullet.ammo = new ComparableStack(ModItems.ammo_nuke, 1, 7);
bullet.style = BulletConfiguration.STYLE_MIRV;
bullet.velocity *= 3;
@ -337,7 +339,7 @@ public class GunFatmanFactory {
BulletConfiguration bullet = getNukeLowConfig();
bullet.ammo = ModItems.ammo_mirv_low;
bullet.ammo = new ComparableStack(ModItems.ammo_nuke, 1, 8);
bullet.style = BulletConfiguration.STYLE_MIRV;
bullet.velocity *= 3;
@ -374,7 +376,7 @@ public class GunFatmanFactory {
BulletConfiguration bullet = getNukeHighConfig();
bullet.ammo = ModItems.ammo_mirv_high;
bullet.ammo = new ComparableStack(ModItems.ammo_nuke, 1, 9);
bullet.style = BulletConfiguration.STYLE_MIRV;
bullet.velocity *= 3;
@ -411,7 +413,7 @@ public class GunFatmanFactory {
BulletConfiguration bullet = getNukeSafeConfig();
bullet.ammo = ModItems.ammo_mirv_safe;
bullet.ammo = new ComparableStack(ModItems.ammo_nuke, 1, 10);
bullet.style = BulletConfiguration.STYLE_MIRV;
bullet.velocity *= 3;
@ -448,7 +450,7 @@ public class GunFatmanFactory {
BulletConfiguration bullet = getNukeConfig();
bullet.ammo = ModItems.ammo_mirv_special;
bullet.ammo = new ComparableStack(ModItems.ammo_nuke, 1, 11);
bullet.style = BulletConfiguration.STYLE_MIRV;
bullet.velocity *= 3;
@ -496,7 +498,7 @@ public class GunFatmanFactory {
BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig();
bullet.ammo = ModItems.gun_bf_ammo;
bullet.ammo = new ComparableStack(ModItems.ammo_nuke, 1, 12);
bullet.style = BulletConfiguration.STYLE_BF;
bullet.bImpact = new IBulletImpactBehavior() {

View File

@ -5,7 +5,9 @@ import java.util.ArrayList;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
public class GunGaussFactory {
@ -27,8 +29,8 @@ public class GunGaussFactory {
config.durability = 6000;
config.firingSound = "hbm:weapon.tauShoot";
config.name = "XVL1456 Tau Cannon";
config.manufacturer = "Black Mesa Research Facility";
config.name = "tau";
config.manufacturer = EnumGunManufacturer.BLACK_MESA;
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.SPECIAL_GAUSS);
@ -60,7 +62,7 @@ public class GunGaussFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.gun_xvl1456_ammo;
bullet.ammo = new ComparableStack(ModItems.gun_xvl1456_ammo);
bullet.dmgMin = 6;
bullet.dmgMax = 9;
bullet.trail = 1;

View File

@ -7,7 +7,9 @@ import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
public class GunGrenadeFactory {
@ -31,8 +33,8 @@ public class GunGrenadeFactory {
config.reloadSound = GunConfiguration.RSOUND_GRENADE;
config.reloadSoundEnd = false;
config.name = "Granatpistole HK69";
config.manufacturer = "Heckler & Koch";
config.name = "gPistol";
config.manufacturer = EnumGunManufacturer.H_AND_K;
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.GRENADE_NORMAL);
@ -51,11 +53,12 @@ public class GunGrenadeFactory {
return config;
}
private static byte i = 0;
public static BulletConfiguration getGrenadeConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = ModItems.ammo_grenade;
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 10;
bullet.dmgMax = 15;
@ -69,7 +72,7 @@ public class GunGrenadeFactory {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = ModItems.ammo_grenade_he;
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 20;
bullet.dmgMax = 15;
@ -84,7 +87,7 @@ public class GunGrenadeFactory {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = ModItems.ammo_grenade_incendiary;
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 15;
bullet.dmgMax = 15;
@ -99,7 +102,7 @@ public class GunGrenadeFactory {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = ModItems.ammo_grenade_phosphorus;
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 15;
bullet.dmgMax = 15;
@ -116,7 +119,7 @@ public class GunGrenadeFactory {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = ModItems.ammo_grenade_toxic;
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 10;
bullet.dmgMax = 15;
@ -132,7 +135,7 @@ public class GunGrenadeFactory {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = ModItems.ammo_grenade_sleek;
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 10;
bullet.dmgMax = 15;
@ -148,7 +151,7 @@ public class GunGrenadeFactory {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = ModItems.ammo_grenade_concussion;
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.dmgMin = 15;
bullet.dmgMax = 20;
@ -163,7 +166,7 @@ public class GunGrenadeFactory {
BulletConfiguration bullet = getGrenadeConfig();
bullet.ammo = ModItems.ammo_grenade_finned;
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.gravity = 0.02;
bullet.explosive = 1.5F;
bullet.trail = 5;
@ -175,7 +178,7 @@ public class GunGrenadeFactory {
BulletConfiguration bullet = getGrenadeConfig();
bullet.ammo = ModItems.ammo_grenade_nuclear;
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 4;
bullet.explosive = 0.0F;
@ -194,7 +197,7 @@ public class GunGrenadeFactory {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = ModItems.ammo_grenade_tracer;
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.velocity = 2.0F;
bullet.wear = 10;
bullet.explosive = 0F;
@ -208,7 +211,7 @@ public class GunGrenadeFactory {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_grenade_kampf;
bullet.ammo = new ComparableStack(ModItems.ammo_grenade, 1, i++);
bullet.spread = 0.0F;
bullet.gravity = 0.0D;
bullet.wear = 15;

View File

@ -9,6 +9,7 @@ import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.lib.ModDamageSource;
import com.hbm.main.MainRegistry;
@ -29,7 +30,7 @@ public class GunNPCFactory {
BulletConfiguration bullet = new BulletConfiguration();
bullet.ammo = ModItems.coin_maskman;
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
bullet.velocity = 0.25F;
bullet.spread = 0.000F;
bullet.wear = 10;
@ -84,7 +85,7 @@ public class GunNPCFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.coin_maskman;
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
bullet.spread = 0.0F;
bullet.dmgMin = 15;
bullet.dmgMax = 20;
@ -102,7 +103,7 @@ public class GunNPCFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.coin_maskman;
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
bullet.spread = 0.0F;
bullet.dmgMin = 5;
bullet.dmgMax = 10;
@ -118,7 +119,7 @@ public class GunNPCFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.coin_maskman;
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
bullet.spread = 0.0F;
bullet.dmgMin = 15;
bullet.dmgMax = 20;
@ -151,7 +152,7 @@ public class GunNPCFactory {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = ModItems.coin_maskman;
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
bullet.gravity = 0.1D;
bullet.velocity = 1.0F;
bullet.dmgMin = 15;
@ -167,7 +168,7 @@ public class GunNPCFactory {
BulletConfiguration bullet = BulletConfigFactory.standardGrenadeConfig();
bullet.ammo = ModItems.coin_maskman;
bullet.ammo = new ComparableStack(ModItems.coin_maskman);
bullet.gravity = 0.1D;
bullet.velocity = 1.0F;
bullet.dmgMin = 20;
@ -205,7 +206,7 @@ public class GunNPCFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.coin_worm;
bullet.ammo = new ComparableStack(ModItems.coin_worm);
bullet.spread = 0.0F;
bullet.maxAge = 60;
bullet.dmgMin = 15;
@ -222,7 +223,7 @@ public class GunNPCFactory {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.coin_worm;
bullet.ammo = new ComparableStack(ModItems.coin_worm);
bullet.spread = 0.0F;
bullet.maxAge = 100;
bullet.dmgMin = 35;

View File

@ -2,12 +2,21 @@ package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.blocks.generic.RedBarrel;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.lib.ModDamageSource;
import com.hbm.potion.HbmPotion;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.PotionEffect;
public class GunOSIPRFactory {
public static GunConfiguration getOSIPRConfig() {
@ -24,13 +33,13 @@ public class GunOSIPRFactory {
config.reloadType = GunConfiguration.RELOAD_FULL;
config.allowsInfinity = true;
config.crosshair = Crosshair.L_ARROWS;
config.durability = 10000;
config.durability = 50_000;
config.reloadSound = "hbm:weapon.osiprReload";
config.firingSound = "hbm:weapon.osiprShoot";
config.reloadSoundEnd = false;
config.name = "Overwatch Standard Issue Pulse Rifle";
config.manufacturer = "The Universal Union";
config.name = "osipr";
config.manufacturer = EnumGunManufacturer.COMBINE;
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.SPECIAL_OSIPR);
@ -59,24 +68,71 @@ public class GunOSIPRFactory {
return config;
}
static float inaccuracy = 5;
static float inaccuracy = 1.25F;
public static BulletConfiguration getPulseConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.gun_osipr_ammo;
bullet.ammo = new ComparableStack(ModItems.gun_osipr_ammo);
bullet.ammoCount = 30;
bullet.doesRicochet = false;
bullet.spread *= inaccuracy;
bullet.dmgMin = 3;
bullet.dmgMax = 5;
bullet.dmgMin = 15;
bullet.dmgMax = 21;
bullet.trail = 2;
return bullet;
}
public static BulletConfiguration getPulseChargedConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
bullet.ammo = ModItems.gun_osipr_ammo2;
bullet.ammo = new ComparableStack(ModItems.gun_osipr_ammo2);
bullet.ricochetAngle = 360;
bullet.LBRC = 100;
bullet.HBRC = 100;
bullet.bounceMod = 1;
bullet.style = BulletConfiguration.STYLE_ORB;
bullet.damageType = ModDamageSource.s_combineball;
bullet.liveAfterImpact = true;
bullet.spread = 0;
bullet.gravity = 0;
bullet.maxAge = 150;
bullet.velocity = 2;
bullet.bHurt = (ball, entity) -> {
if(entity instanceof EntityLivingBase) {
EntityLivingBase entityLiving = (EntityLivingBase) entity;
entity.addVelocity(ball.motionX / 2, ball.motionY / 2, ball.motionZ / 2);
if(entity == ball.shooter)
return;
if(entityLiving.getHealth() <= 1000) {
entityLiving.addPotionEffect(new PotionEffect(HbmPotion.bang.id, 1, 0));
entityLiving.setLastAttacker(ball.shooter);
} else if(entityLiving.getHealth() > 1000) {
ball.setDead();
return;
}
}
};
bullet.bRicochet = (ball, x, y, z) -> {
Block block = ball.worldObj.getBlock(x, y, z);
if(block instanceof RedBarrel)
((RedBarrel) block).explode(ball.worldObj, x, y, z);
};
bullet.bImpact = (ball, x, y, z) -> {
final Block block = ball.worldObj.getBlock(x, y, z);
if(block instanceof RedBarrel)
((RedBarrel) block).explode(ball.worldObj, x, y, z);
};
return bullet;
}

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import net.minecraft.util.EnumChatFormatting;
@ -27,7 +28,7 @@ public class GunPoweredFactory {
config.chargeRate = 2500;
config.name = "LIY2001 Anti-Material Electromagnetic Rifle Prototype";
config.manufacturer = "OxfordEM technologies";
config.manufacturer = EnumGunManufacturer.OXFORD;
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.GLASS_EMRADIO);
@ -41,35 +42,6 @@ public class GunPoweredFactory {
return config;
}
/*public static BulletConfiguration getGlassBoltConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.velocity = 2.0F;
bullet.spread = 0F;
bullet.dmgMin = 30;
bullet.dmgMax = 40;
bullet.bulletsMin = 1;
bullet.bulletsMax = 1;
bullet.gravity = 0D;
bullet.maxAge = 100;
bullet.doesRicochet = true;
bullet.ricochetAngle = 90;
bullet.HBRC = 2;
bullet.LBRC = 90;
bullet.bounceMod = 1;
bullet.doesPenetrate = true;
bullet.style = BulletConfiguration.STYLE_BOLT;
bullet.plink = BulletConfiguration.PLINK_ENERGY;
bullet.trail = BulletConfiguration.BOLT_LASER;
bullet.dischargePerShot = 1000;
bullet.firingRate = 5;
bullet.modeName = "testMode";
bullet.chatColour = EnumChatFormatting.RED;
return bullet;
}*/
public static BulletConfiguration getEMRadioConfig() {
BulletConfiguration bullet = new BulletConfiguration();

View File

@ -10,7 +10,9 @@ import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.interfaces.IBulletRicochetBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationKeyframe;
import com.hbm.render.anim.BusAnimationSequence;
@ -40,8 +42,8 @@ public class GunRocketFactory {
config.reloadSound = GunConfiguration.RSOUND_LAUNCHER;
config.reloadSoundEnd = false;
config.name = "Carl Gustav Recoilless Rifle M1";
config.manufacturer = "Saab Bofors Dynamics";
config.name = "gustav";
config.manufacturer = EnumGunManufacturer.SAAB;
config.comment.add("Fun fact of the day: Recoilless");
config.comment.add("rifles don't actually fire rockets.");
@ -103,8 +105,8 @@ public class GunRocketFactory {
)
);
config.name = "OpenQuadro Guided Man-Portable Missile Launcher";
config.manufacturer = "Open Mann Co.";
config.name = "quadro";
config.manufacturer = EnumGunManufacturer.MANN;
config.comment.add("For the next three hundred years, people who needed to get to the second");
config.comment.add("floor used the only method available to them, which was rocket jumping.");
config.comment.add("This persisted until 1857, when the young bearded inventor named");
@ -134,8 +136,8 @@ public class GunRocketFactory {
config.reloadDuration = 20;
config.name = "M1 Karl-Gerät";
config.manufacturer = "???";
config.name = "karl";
config.manufacturer = EnumGunManufacturer.UNKNOWN;
config.comment.clear();
config.config = new ArrayList<Integer>();
@ -159,8 +161,8 @@ public class GunRocketFactory {
config.reloadDuration = 25;
config.hasSights = true;
config.name = "Raketenpanzerbüchse 54";
config.manufacturer = "Enzinger Union";
config.name = "panz";
config.manufacturer = EnumGunManufacturer.ENZINGER;
config.comment.clear();
config.comment.add("Panzer-Shrek");
@ -169,11 +171,12 @@ public class GunRocketFactory {
return config;
}
private static byte i = 0;
public static BulletConfiguration getRocketConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_rocket;
bullet.ammo = new ComparableStack(ModItems.ammo_rocket, 1, i++);
bullet.dmgMin = 10;
bullet.dmgMax = 15;
bullet.explosive = 4F;
@ -186,7 +189,7 @@ public class GunRocketFactory {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_rocket_he;
bullet.ammo = new ComparableStack(ModItems.ammo_rocket, 1, i++);
bullet.dmgMin = 10;
bullet.dmgMax = 15;
bullet.wear = 15;
@ -200,7 +203,7 @@ public class GunRocketFactory {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_rocket_incendiary;
bullet.ammo = new ComparableStack(ModItems.ammo_rocket, 1, i++);
bullet.dmgMin = 10;
bullet.dmgMax = 15;
bullet.wear = 15;
@ -215,7 +218,7 @@ public class GunRocketFactory {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_rocket_emp;
bullet.ammo = new ComparableStack(ModItems.ammo_rocket, 1, i++);
bullet.dmgMin = 10;
bullet.dmgMax = 15;
bullet.explosive = 2.5F;
@ -229,7 +232,7 @@ public class GunRocketFactory {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_rocket_sleek;
bullet.ammo = new ComparableStack(ModItems.ammo_rocket, 1, i++);
bullet.dmgMin = 10;
bullet.dmgMax = 15;
bullet.explosive = 10F;
@ -244,7 +247,7 @@ public class GunRocketFactory {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_rocket_shrapnel;
bullet.ammo = new ComparableStack(ModItems.ammo_rocket, 1, i++);
bullet.dmgMin = 10;
bullet.dmgMax = 15;
bullet.explosive = 4F;
@ -258,7 +261,7 @@ public class GunRocketFactory {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_rocket_glare;
bullet.ammo = new ComparableStack(ModItems.ammo_rocket, 1, i++);
bullet.velocity = 5.0F;
bullet.dmgMin = 10;
bullet.dmgMax = 15;
@ -274,7 +277,7 @@ public class GunRocketFactory {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_rocket_nuclear;
bullet.ammo = new ComparableStack(ModItems.ammo_rocket, 1, i++);
bullet.velocity = 1.5F;
bullet.dmgMin = 10;
bullet.dmgMax = 15;
@ -298,7 +301,7 @@ public class GunRocketFactory {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_rocket_toxic;
bullet.ammo = new ComparableStack(ModItems.ammo_rocket, 1, i++);
bullet.velocity = 1.5F;
bullet.dmgMin = 10;
bullet.dmgMax = 15;
@ -314,7 +317,7 @@ public class GunRocketFactory {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_rocket_rpc;
bullet.ammo = new ComparableStack(ModItems.ammo_rocket, 1, i++);
bullet.velocity = 3.0F;
bullet.dmgMin = 20;
bullet.dmgMax = 25;
@ -328,7 +331,8 @@ public class GunRocketFactory {
bullet.doesPenetrate = true;
bullet.bRicochet = new IBulletRicochetBehavior() {
@Override
public void behaveBlockRicochet(EntityBulletBase bullet, int bX, int bY, int bZ) {
World worldObj = bullet.worldObj;
if(!worldObj.isRemote &&
@ -347,7 +351,7 @@ public class GunRocketFactory {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_rocket_phosphorus;
bullet.ammo = new ComparableStack(ModItems.ammo_rocket, 1, i++);
bullet.dmgMin = 10;
bullet.dmgMax = 15;
bullet.wear = 15;
@ -364,7 +368,7 @@ public class GunRocketFactory {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_rocket_canister;
bullet.ammo = new ComparableStack(ModItems.ammo_rocket, 1, i++);
bullet.dmgMin = 10;
bullet.dmgMax = 15;
bullet.explosive = 2F;
@ -399,7 +403,7 @@ public class GunRocketFactory {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_rocket_digamma;
bullet.ammo = new ComparableStack(ModItems.ammo_rocket, 1, i++);
bullet.velocity = 0.5F;
bullet.dmgMin = 10;
bullet.dmgMax = 15;

View File

@ -3,13 +3,14 @@ package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityRocket;
import com.hbm.entity.projectile.EntityRocketHoming;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import net.minecraft.entity.player.EntityPlayer;
@ -34,8 +35,8 @@ public class GunRocketHomingFactory {
config.reloadSound = GunConfiguration.RSOUND_LAUNCHER;
config.reloadSoundEnd = false;
config.name = "FIM-92 Stinger man-portable air-defense system";
config.manufacturer = "Raytheon Missile Systems";
config.name = "stinger";
config.manufacturer = EnumGunManufacturer.RAYTHEON;
config.comment.add("Woosh, beep-beep-beep!");
config.config = new ArrayList<Integer>();
@ -66,8 +67,8 @@ GunConfiguration config = new GunConfiguration();
config.reloadSound = GunConfiguration.RSOUND_LAUNCHER;
config.reloadSoundEnd = false;
config.name = "The One Sky Stinger";
config.manufacturer = "Equestria Missile Systems";
config.name = "stingerOneSky";
config.manufacturer = EnumGunManufacturer.EQUESTRIA;
config.comment.add("Oh, I get it, because of the...nyeees!");
config.comment.add("It all makes sense now!");
config.comment.add("");
@ -87,10 +88,11 @@ GunConfiguration config = new GunConfiguration();
return config;
}
private static byte i = 0;
public static BulletConfiguration getRocketStingerConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_stinger_rocket;
bullet.ammo = new ComparableStack(ModItems.ammo_stinger_rocket, 1, i++);
bullet.dmgMin = 20;
bullet.dmgMax = 25;
bullet.explosive = 4F;
@ -126,7 +128,7 @@ GunConfiguration config = new GunConfiguration();
public static BulletConfiguration getRocketStingerHEConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_stinger_rocket_he;
bullet.ammo = new ComparableStack(ModItems.ammo_stinger_rocket, 1, i++);
bullet.dmgMin = 30;
bullet.dmgMax = 35;
bullet.explosive = 8F;
@ -163,7 +165,7 @@ GunConfiguration config = new GunConfiguration();
public static BulletConfiguration getRocketStingerIncendiaryConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_stinger_rocket_incendiary;
bullet.ammo = new ComparableStack(ModItems.ammo_stinger_rocket, 1, i++);
bullet.dmgMin = 15;
bullet.dmgMax = 20;
bullet.explosive = 4F;
@ -200,7 +202,7 @@ GunConfiguration config = new GunConfiguration();
public static BulletConfiguration getRocketStingerNuclearConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_stinger_rocket_nuclear;
bullet.ammo = new ComparableStack(ModItems.ammo_stinger_rocket, 1, i++);
bullet.dmgMin = 50;
bullet.dmgMax = 55;
bullet.explosive = 15F;
@ -237,7 +239,7 @@ GunConfiguration config = new GunConfiguration();
public static BulletConfiguration getRocketStingerBonesConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
bullet.ammo = ModItems.ammo_stinger_rocket_bones;
bullet.ammo = new ComparableStack(ModItems.ammo_stinger_rocket, 1, i++);
bullet.dmgMin = 20;
bullet.dmgMax = 25;
bullet.explosive = 8F;

View File

@ -2,6 +2,7 @@ package com.hbm.items;
import java.util.Set;
import com.google.common.collect.ImmutableSet;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.guncfg.*;
import com.hbm.items.weapon.ItemAmmo.AmmoItemTrait;

View File

@ -11,391 +11,23 @@ import net.minecraft.world.World;
public class ItemClip extends Item {
public ItemClip()
{
this.setMaxDamage(1);
}
public ItemClip() {
this.setMaxDamage(1);
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
stack.stackSize--;
if(stack.stackSize <= 0)
stack.damageItem(5, player);
if(this == ModItems.clip_revolver_iron)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_iron_ammo, 20)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_revolver_iron_ammo, 20), false);
}
}
if(this == ModItems.clip_revolver)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_ammo, 12)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_revolver_ammo, 12), false);
}
}
if(this == ModItems.clip_revolver_gold)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_gold_ammo, 4)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_revolver_gold_ammo, 4), false);
}
}
if(this == ModItems.clip_revolver_schrabidium)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_schrabidium_ammo, 2)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_revolver_schrabidium_ammo, 2), false);
}
}
if(this == ModItems.clip_rpg)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_rocket, 3)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_rpg_ammo, 3), false);
}
}
if(this == ModItems.clip_osipr)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_osipr_ammo, 30)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_osipr_ammo, 30), false);
}
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_osipr_ammo2, 1)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_osipr_ammo2, 1), false);
}
}
if(this == ModItems.clip_xvl1456)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_xvl1456_ammo, 60)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_xvl1456_ammo, 60), false);
}
}
if(this == ModItems.clip_revolver_lead)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_lead_ammo, 12)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_revolver_lead_ammo, 12), false);
}
}
if(this == ModItems.clip_revolver_cursed)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_cursed_ammo, 17)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_revolver_cursed_ammo, 17), false);
}
}
if(this == ModItems.clip_fatman)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_nuke, 6)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_fatman_ammo, 6), false);
}
}
if(this == ModItems.clip_mp)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_566_gold, 30)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp_ammo, 30), false);
}
}
if(this == ModItems.clip_mp40)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_9mm, 32)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_uzi)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_22lr, 32)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_uzi_ammo, 32), false);
}
}
if(this == ModItems.clip_uboinik)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_12gauge, 24)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_uboinik_ammo, 24), false);
}
}
if(this == ModItems.clip_lever_action)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_20gauge, 24)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_lever_action_ammo, 24), false);
}
}
if(this == ModItems.clip_bolt_action)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_20gauge_slug, 24)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_bolt_action_ammo, 24), false);
}
}
if(this == ModItems.clip_mirv)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_mirv, 3)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_bf)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_bf_ammo, 2)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_immolator)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_immolator_ammo, 60)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_cryolator)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_cryolator_ammo, 60)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_emp)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_emp_ammo, 6)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_revolver_nightmare)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_nightmare_ammo, 6)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_revolver_nightmare2)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_nightmare2_ammo, 6)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_revolver_pip)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_44_pip, 6)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_revolver_nopip)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_44, 12)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_stinger)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_stinger_rocket, 3)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_jack)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_jack_ammo, 6)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_spark)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_spark_ammo, 4)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_hp)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_hp_ammo, 8)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_euthanasia)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_euthanasia_ammo, 16)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.clip_defabricator)
{
if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_defabricator_ammo, 12)))
{
//player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.gun_mp40_ammo, 32), false);
}
}
if(this == ModItems.ammo_container)
{
if(player.inventory.hasItem(ModItems.gun_revolver_iron))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_iron_ammo, 24));
if(player.inventory.hasItem(ModItems.gun_revolver))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_ammo, 12));
if(player.inventory.hasItem(ModItems.gun_revolver_gold))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_gold_ammo, 4));
if(player.inventory.hasItem(ModItems.gun_revolver_lead))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_lead_ammo, 6));
if(player.inventory.hasItem(ModItems.gun_revolver_schrabidium))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_schrabidium_ammo, 2));
if(player.inventory.hasItem(ModItems.gun_revolver_cursed))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_cursed_ammo, 8));
if(player.inventory.hasItem(ModItems.gun_revolver_nightmare))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_nightmare_ammo, 6));
if(player.inventory.hasItem(ModItems.gun_revolver_nightmare2))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_nightmare2_ammo, 3));
if(player.inventory.hasItem(ModItems.gun_revolver_pip))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_44_pip, 12));
if(player.inventory.hasItem(ModItems.gun_revolver_nopip))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_44, 12));
if(player.inventory.hasItem(ModItems.gun_revolver_blackjack))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_44_bj, 12));
if(player.inventory.hasItem(ModItems.gun_revolver_red))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_44, 12));
if(player.inventory.hasItem(ModItems.gun_calamity))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_50bmg, 16));
if(player.inventory.hasItem(ModItems.gun_calamity_dual))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_50bmg, 32));
if(player.inventory.hasItem(ModItems.gun_minigun)) {
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_5mm, 64));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_5mm, 64));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_5mm, 64));
}
if(player.inventory.hasItem(ModItems.gun_avenger)) {
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_5mm, 64));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_5mm, 64));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_5mm, 64));
}
if(player.inventory.hasItem(ModItems.gun_lacunae)) {
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_5mm, 64));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_5mm, 64));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_5mm, 64));
}
if(player.inventory.hasItem(ModItems.gun_rpg))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_rocket, 3));
if(player.inventory.hasItem(ModItems.gun_stinger))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_stinger_rocket, 2));
if(player.inventory.hasItem(ModItems.gun_skystinger))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_stinger_rocket_he, 2));
if(player.inventory.hasItem(ModItems.gun_fatman))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_nuke, 2));
if(player.inventory.hasItem(ModItems.gun_proto))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_nuke, 8));
if(player.inventory.hasItem(ModItems.gun_mirv))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_mirv, 1));
if(player.inventory.hasItem(ModItems.gun_bf))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_bf_ammo, 1));
if(player.inventory.hasItem(ModItems.gun_mp40))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_9mm, 32));
if(player.inventory.hasItem(ModItems.gun_uzi))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_22lr, 32));
if(player.inventory.hasItem(ModItems.gun_uzi_silencer))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_22lr, 32));
if(player.inventory.hasItem(ModItems.gun_uzi_saturnite))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_22lr, 32));
if(player.inventory.hasItem(ModItems.gun_uzi_saturnite_silencer))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_22lr, 32));
if(player.inventory.hasItem(ModItems.gun_uboinik))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_12gauge, 12));
if(player.inventory.hasItem(ModItems.gun_lever_action))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_20gauge, 12));
if(player.inventory.hasItem(ModItems.gun_lever_action_dark))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_20gauge, 12));
if(player.inventory.hasItem(ModItems.gun_lever_action_sonata))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_20gauge, 1));
if(player.inventory.hasItem(ModItems.gun_bolt_action))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_20gauge_flechette, 12));
if(player.inventory.hasItem(ModItems.gun_bolt_action_green))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_20gauge_flechette, 12));
if(player.inventory.hasItem(ModItems.gun_xvl1456))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_xvl1456_ammo, 40));
if(player.inventory.hasItem(ModItems.gun_osipr)) {
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_osipr_ammo, 30));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_osipr_ammo2, 1));
}
if(player.inventory.hasItem(ModItems.gun_immolator))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_immolator_ammo, 40));
if(player.inventory.hasItem(ModItems.gun_cryolator))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_cryolator_ammo, 40));
if(player.inventory.hasItem(ModItems.gun_mp))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ammo_566_gold, 34));
if(player.inventory.hasItem(ModItems.gun_zomg))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.nugget_euphemium, 1));
if(player.inventory.hasItem(ModItems.gun_emp))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_emp_ammo, 8));
if(player.inventory.hasItem(ModItems.gun_revolver_inverted))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_ammo, 1));
if(player.inventory.hasItem(ModItems.gun_revolver_inverted))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_ammo, 1));
if(player.inventory.hasItem(ModItems.gun_jack))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_jack_ammo, 3));
if(player.inventory.hasItem(ModItems.gun_spark))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_spark_ammo, 2));
if(player.inventory.hasItem(ModItems.gun_hp))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_hp_ammo, 6));
if(player.inventory.hasItem(ModItems.gun_euthanasia))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_euthanasia_ammo, 8));
if(player.inventory.hasItem(ModItems.gun_defabricator))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_defabricator_ammo, 6));
}
return stack;
}
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool)
{
if(this == ModItems.ammo_container)
{
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
if(this == ModItems.ammo_container) {
list.add("Gives ammo for all held weapons.");
}
}

View File

@ -12,6 +12,9 @@ import com.hbm.handler.GunConfiguration;
import com.hbm.handler.HbmKeybinds;
import com.hbm.interfaces.IHoldableWeapon;
import com.hbm.interfaces.IItemHUD;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.IEquipReceiver;
import com.hbm.lib.HbmCollection;
import com.hbm.packet.GunAnimationPacket;
import com.hbm.packet.GunButtonPacket;
import com.hbm.packet.PacketDispatcher;
@ -19,12 +22,13 @@ import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import com.hbm.util.I18nUtil;
import com.hbm.util.InventoryUtil;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
@ -39,7 +43,7 @@ import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEquipReceiver {
public GunConfiguration mainConfig;
public GunConfiguration altConfig;
@ -278,112 +282,6 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
//called on click release (client side, called by update cycle)
public void endActionClient(ItemStack stack, World world, EntityPlayer player, boolean main) { }
//reload action, if existent
protected void reload(ItemStack stack, World world, EntityPlayer player) {
if(getReloadCycle(stack) < 0 && stack == player.getHeldItem()) {
//if the mag has bullet in them -> load only the same type
if(getMag(stack) > 0) {
BulletConfiguration bulletCfg = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
Item ammo = bulletCfg.ammo;
//how many bullets to load
int count = 1;
if(mainConfig.reloadType == 1) {
count = mainConfig.ammoCap - getMag(stack);
}
if(count == 0)
setIsReloading(stack, false);
for(int i = 0; i < count; i++) {
if(getMag(stack) < mainConfig.ammoCap) {
if(player.inventory.hasItem(ammo)) {
player.inventory.consumeInventoryItem(ammo);
setMag(stack, Math.min(getMag(stack) + bulletCfg.ammoCount, mainConfig.ammoCap));
} else {
setIsReloading(stack, false);
world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F);
break;
}
}
if(getMag(stack) == mainConfig.ammoCap) {
setIsReloading(stack, false);
world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F);
break;
} else {
resetReloadCycle(stack);
}
}
//if the mag has no bullets in them -> load new type
} else {
BulletConfiguration bulletCfg = null;
//determine new type
for(Integer config : mainConfig.config) {
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config);
if(player.inventory.hasItem(cfg.ammo)) {
bulletCfg = cfg;
setMagType(stack, mainConfig.config.indexOf(config));
break;
}
}
//load new type if bullets are present
if(bulletCfg != null) {
int count = 1;
if(mainConfig.reloadType == 1) {
count = mainConfig.ammoCap - getMag(stack);
}
for(int i = 0; i < count; i++) {
if(getMag(stack) < mainConfig.ammoCap) {
if(player.inventory.hasItem(bulletCfg.ammo)) {
player.inventory.consumeInventoryItem(bulletCfg.ammo);
setMag(stack, Math.min(getMag(stack) + bulletCfg.ammoCount, mainConfig.ammoCap));
} else {
setIsReloading(stack, false);
world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F);
break;
}
}
if(getMag(stack) == mainConfig.ammoCap) {
setIsReloading(stack, false);
world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F);
break;
} else {
resetReloadCycle(stack);
}
}
}
}
} else {
setReloadCycle(stack, getReloadCycle(stack) - 1);
}
if(stack != player.getHeldItem()) {
setReloadCycle(stack, 0);
setIsReloading(stack, false);
}
}
//martin 2 reload algorithm
//now with less WET and more DRY
//compact, readable and most importantly, FUNCTIONAL
@ -393,45 +291,40 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
setIsReloading(stack, false);
return;
}
if(getReloadCycle(stack) <= 0) {
if(getReloadCycle(stack) < 0) {
if(getMag(stack) == 0)
if (getMag(stack) == 0)
resetAmmoType(stack, world, player);
int count = 1;
if(mainConfig.reloadType == mainConfig.RELOAD_FULL) {
count = mainConfig.ammoCap - getMag(stack);
}
boolean hasLoaded = false;
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
Item ammo = cfg.ammo;
ComparableStack ammo = (ComparableStack) cfg.ammo.copy();
for(int i = 0; i < count; i++) {
if(player.inventory.hasItem(ammo) && getMag(stack) < mainConfig.ammoCap) {
player.inventory.consumeInventoryItem(ammo);
setMag(stack, Math.min(getMag(stack) + cfg.ammoCount, mainConfig.ammoCap));
hasLoaded = true;
} else {
setIsReloading(stack, false);
break;
}
}
final int countNeeded = (mainConfig.reloadType == GunConfiguration.RELOAD_FULL) ? mainConfig.ammoCap - getMag(stack) : 1;
final int availableStacks = InventoryUtil.countAStackMatches(player, ammo, true);
final int availableFills = availableStacks * cfg.ammoCount;
final boolean hasLoaded = availableFills > 0;
final int toAdd = Math.min(availableFills * cfg.ammoCount, countNeeded);
final int toConsume = (int) Math.ceil((double) toAdd / cfg.ammoCount);
if(getMag(stack) >= mainConfig.ammoCap) {
// Skip logic if cannot reload
if (availableFills == 0)
{
setIsReloading(stack, false);
} else {
resetReloadCycle(stack);
return;
}
ammo.stacksize = toConsume;
setMag(stack, getMag(stack) + toAdd);
if (getMag(stack) >= mainConfig.ammoCap)
setIsReloading(stack, false);
else
resetReloadCycle(stack);
if(hasLoaded && mainConfig.reloadSoundEnd)
world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F);
InventoryUtil.tryConsumeAStack(player.inventory.mainInventory, 0, player.inventory.mainInventory.length, ammo);
} else {
setReloadCycle(stack, getReloadCycle(stack) - 1);
}
@ -479,20 +372,15 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
if(getMag(stack) == 0) {
for(Integer config : mainConfig.config) {
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config);
if(player.inventory.hasItem(cfg.ammo)) {
for(int config : mainConfig.config) {
if(InventoryUtil.doesPlayerHaveAStack(player, BulletConfigSyncingUtil.pullConfig(config).ammo, false, false)) {
return true;
}
}
} else {
Item ammo = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack))).ammo;
if(player.inventory.hasItem(ammo))
return true;
ComparableStack ammo = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack))).ammo;
return InventoryUtil.doesPlayerHaveAStack(player, ammo, false, false);
}
return false;
@ -501,11 +389,10 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
//searches the player's inv for next fitting ammo type and changes the gun's mag
protected void resetAmmoType(ItemStack stack, World world, EntityPlayer player) {
for(Integer config : mainConfig.config) {
for(int config : mainConfig.config) {
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config);
if(player.inventory.hasItem(cfg.ammo)) {
if(InventoryUtil.doesPlayerHaveAStack(player, cfg.ammo, false, false)) {
setMagType(stack, mainConfig.config.indexOf(config));
break;
}
@ -516,40 +403,46 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
Item ammo = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack))).ammo;
ComparableStack ammo = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack))).ammo;
if(mainConfig.ammoCap > 0)
list.add("Ammo: " + getMag(stack) + " / " + mainConfig.ammoCap);
else
list.add("Ammo: Belt");
list.add(I18nUtil.resolveKey(HbmCollection.ammo, mainConfig.ammoCap > 0 ? I18nUtil.resolveKey(HbmCollection.ammoMag, getMag(stack), mainConfig.ammoCap) : I18nUtil.resolveKey(HbmCollection.ammoBelt)));
list.add("Ammo Type: " + I18n.format(ammo.getUnlocalizedName() + ".name"));
if(altConfig != null && altConfig.ammoCap == 0) {
Item ammo2 = BulletConfigSyncingUtil.pullConfig(altConfig.config.get(0)).ammo;
if(ammo != ammo2)
list.add("Secondary Ammo: " + I18n.format(ammo2.getUnlocalizedName() + ".name"));
try {
list.add(I18nUtil.resolveKey(HbmCollection.ammoType, ammo.toStack().getDisplayName()));
if(altConfig != null && altConfig.ammoCap == 0) {
ComparableStack ammo2 = BulletConfigSyncingUtil.pullConfig(altConfig.config.get(0)).ammo;
if(!ammo.isApplicable(ammo2)) {
list.add(I18nUtil.resolveKey(HbmCollection.altAmmoType, ammo2.toStack().getDisplayName()));
}
}
}
catch (Exception e)
{
e.printStackTrace();
list.add("Error: " + e + " has occurred!");
}
addAdditionalInformation(stack, list);
}
protected void addAdditionalInformation(ItemStack stack, List<String> list)
{
final BulletConfiguration bulletConfig = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
list.add(I18nUtil.resolveKey(HbmCollection.gunDamage, bulletConfig.dmgMin, bulletConfig.dmgMax));
int dura = Math.max(mainConfig.durability - getItemWear(stack), 0);
int dura = mainConfig.durability - getItemWear(stack);
list.add(I18nUtil.resolveKey(HbmCollection.durability, dura + " / " + mainConfig.durability));
if(dura < 0)
dura = 0;
list.add("Durability: " + dura + " / " + mainConfig.durability);
//if(MainRegistry.enableDebugMode) {
list.add("");
list.add("Name: " + mainConfig.name);
list.add("Manufacturer: " + mainConfig.manufacturer);
//}
list.add("");
list.add(I18nUtil.resolveKey(HbmCollection.gunName, I18nUtil.resolveKey("gun.name." + mainConfig.name)));
list.add(I18nUtil.resolveKey(HbmCollection.gunMaker, I18nUtil.resolveKey(mainConfig.manufacturer.getKey())));
if(!mainConfig.comment.isEmpty()) {
list.add("");
for(String s : mainConfig.comment)
list.add(EnumChatFormatting.ITALIC + s);
}
if(GeneralConfig.enableExtendedLogging) {
list.add("");
list.add("Type: " + getMagType(stack));
@ -560,17 +453,16 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
}
//returns ammo item of belt-weapons
public static Item getBeltType(EntityPlayer player, ItemStack stack, boolean main) {
public static ComparableStack getBeltType(EntityPlayer player, ItemStack stack, boolean main) {
ItemGunBase gun = (ItemGunBase)stack.getItem();
GunConfiguration guncfg = main ? gun.mainConfig : (gun.altConfig != null ? gun.altConfig : gun.mainConfig);
Item ammo = BulletConfigSyncingUtil.pullConfig(guncfg.config.get(0)).ammo;
ComparableStack ammo = BulletConfigSyncingUtil.pullConfig(guncfg.config.get(0)).ammo;
for(Integer config : guncfg.config) {
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config);
if(player.inventory.hasItem(cfg.ammo)) {
if(InventoryUtil.doesPlayerHaveAStack(player, cfg.ammo, false, false)) {
ammo = cfg.ammo;
break;
}
@ -581,30 +473,29 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
//returns BCFG of belt-weapons
public static BulletConfiguration getBeltCfg(EntityPlayer player, ItemStack stack, boolean main) {
ItemGunBase gun = (ItemGunBase)stack.getItem();
GunConfiguration guncfg = main ? gun.mainConfig : (gun.altConfig != null ? gun.altConfig : gun.mainConfig);
getBeltType(player, stack, main);
for(Integer config : guncfg.config) {
for(int config : guncfg.config) {
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config);
if(player.inventory.hasItem(cfg.ammo)) {
if(InventoryUtil.doesPlayerHaveAStack(player, cfg.ammo, false, false)) {
return cfg;
}
}
return BulletConfigSyncingUtil.pullConfig(guncfg.config.get(0));
}
//returns ammo capacity of belt-weapons for current ammo
public static int getBeltSize(EntityPlayer player, Item ammo) {
public static int getBeltSize(EntityPlayer player, ComparableStack ammo) {
int amount = 0;
for(ItemStack stack : player.inventory.mainInventory) {
if(stack != null && stack.getItem() == ammo)
if(stack != null && ammo.matchesRecipe(stack, true))
amount += stack.stackSize;
}
@ -625,11 +516,10 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
if(hasInfinity(stack, config))
return;
if(config.reloadType != mainConfig.RELOAD_NONE) {
if(config.reloadType != GunConfiguration.RELOAD_NONE) {
setMag(stack, getMag(stack) - 1);
} else {
player.inventory.consumeInventoryItem(getBeltType(player, stack, main));
InventoryUtil.doesPlayerHaveAStack(player, getBeltType(player, stack, main), true, false);
}
}
@ -637,16 +527,6 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
return config.allowsInfinity && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
}
/*//returns main config from itemstack
public static GunConfiguration extractConfig(ItemStack stack) {
if(stack != null && stack.getItem() instanceof ItemGunBase) {
return ((ItemGunBase)stack.getItem()).mainConfig;
}
return null;
}*/
/// sets reload cycle to config defult ///
public static void resetReloadCycle(ItemStack stack) {
writeNBT(stack, "reload", ((ItemGunBase)stack.getItem()).mainConfig.reloadDuration);
@ -769,7 +649,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
return;
}
Item ammo = bcfg.ammo;
ComparableStack ammo = bcfg.ammo;
int count = ItemGunBase.getMag(stack);
int max = gcfg.ammoCap;
boolean showammo = gcfg.showAmmo;
@ -782,15 +662,15 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
int dura = ItemGunBase.getItemWear(stack) * 50 / gcfg.durability;
RenderScreenOverlay.renderAmmo(event.resolution, Minecraft.getMinecraft().ingameGUI, new ItemStack(ammo), count, max, dura, showammo);
RenderScreenOverlay.renderAmmo(event.resolution, Minecraft.getMinecraft().ingameGUI, ammo.toStack(), count, max, dura, showammo);
if(gun.altConfig != null && gun.altConfig.reloadType == GunConfiguration.RELOAD_NONE) {
Item oldAmmo = ammo;
ComparableStack oldAmmo = ammo;
ammo = ItemGunBase.getBeltType(player, stack, false);
if(ammo != oldAmmo) {
if(!ammo.isApplicable(oldAmmo)) {
count = ItemGunBase.getBeltSize(player, ammo);
RenderScreenOverlay.renderAmmoAlt(event.resolution, Minecraft.getMinecraft().ingameGUI, new ItemStack(ammo), count);
RenderScreenOverlay.renderAmmoAlt(event.resolution, Minecraft.getMinecraft().ingameGUI, ammo.toStack(), count);
}
}
}
@ -811,4 +691,11 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
GunConfiguration config = ((ItemGunBase) stack.getItem()).mainConfig;
return config.animations.get(type);
}
@Override
public void onEquip(EntityPlayer player) {
if(!mainConfig.equipSound.isEmpty() && !player.worldObj.isRemote) {
player.worldObj.playSoundAtEntity(player, mainConfig.equipSound, 1, 1);
}
}
}

View File

@ -76,13 +76,8 @@ public class ItemGunChemthrower extends ItemGunBase implements IFillableItem {
if(hasInfinity(stack, config))
return;
if(config.reloadType != mainConfig.RELOAD_NONE) {
setMag(stack, getMag(stack) - this.getConsumption(stack));
} else {
player.inventory.consumeInventoryItem(getBeltType(player, stack, main));
}
setMag(stack, getMag(stack) - this.getConsumption(stack));
}
@Override

View File

@ -1,6 +1,8 @@
package com.hbm.items.weapon;
import com.hbm.entity.projectile.EntityCombineBall;
import com.hbm.entity.projectile.EntityCombineBallNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.GunConfiguration;
import com.hbm.items.ModItems;
@ -20,7 +22,8 @@ public class ItemGunOSIPR extends ItemGunBase {
setCharge(stack, 1);
world.playSoundAtEntity(player, "hbm:weapon.osiprCharging", 1.0F, 1F);
}
@Override
protected void updateServer(ItemStack stack, World world, EntityPlayer player, int slot, boolean isCurrentItem) {
super.updateServer(stack, world, player, slot, isCurrentItem);
@ -32,9 +35,8 @@ public class ItemGunOSIPR extends ItemGunBase {
int i = getCharge(stack);
if(i >= 20) {
EntityCombineBall entityarrow = new EntityCombineBall(player.worldObj, player, 3.0F);
entityarrow.setDamage(1000);
world.spawnEntityInWorld(entityarrow);
EntityCombineBallNT energyBall = new EntityCombineBallNT(world, BulletConfigSyncingUtil.SPECIAL_OSIPR_CHARGED, player);
world.spawnEntityInWorld(energyBall);
world.playSoundAtEntity(player, altConfig.firingSound, 1.0F, 1F);
setCharge(stack, 0);
setDelay(stack, altConfig.rateOfFire);
@ -43,7 +45,8 @@ public class ItemGunOSIPR extends ItemGunBase {
} else if(i > 0)
setCharge(stack, i + 1);
}
@Override
protected boolean tryShoot(ItemStack stack, World world, EntityPlayer player, boolean main) {
return super.tryShoot(stack, world, player, main) && getCharge(stack) == 0;

View File

@ -168,4 +168,22 @@ public class HbmCollection {
return "gun.make." + toString();
}
}
// GUN DETAILS
public static final String ammo = "desc.item.gun.ammo";
public static final String ammoMag = "desc.item.gun.ammoMag";
public static final String ammoBelt = "desc.item.gun.ammoBelt";
public static final String ammoEnergy = "desc.item.gun.ammoEnergy";
public static final String altAmmoEnergy = "desc.item.gun.ammoEnergyAlt";
public static final String ammoType = "desc.item.gun.ammoType";
public static final String altAmmoType = "desc.item.gun.ammoTypeAlt";
public static final String gunName = "desc.item.gun.name";
public static final String gunMaker = "desc.item.gun.manufacturer";
public static final String gunDamage = "desc.item.gun.damage";
// MISC
public static final String capacity = "desc.block.barrel.capacity";
public static final String durability = "desc.item.durability";
public static final String meltPoint = "desc.misc.meltPoint";
public static final String lctrl = "desc.misc.lctrl";
public static final String lshift = "desc.misc.lshift";
}

View File

@ -38,9 +38,7 @@ public class RenderLoot extends TileEntitySpecialRenderer {
GL11.glPushMatrix();
GL11.glTranslated(item.getX(), item.getY(), item.getZ());
if(stack.getItem() == ModItems.ammo_nuke || stack.getItem() == ModItems.ammo_nuke_low ||
stack.getItem() == ModItems.ammo_nuke_high || stack.getItem() == ModItems.ammo_nuke_safe ||
stack.getItem() == ModItems.ammo_nuke_pumpkin) {
if(stack.getItem() == ModItems.ammo_nuke) {
renderNuke();
} else if(stack.getItem() == ModItems.gun_fatman || stack.getItem() == ModItems.gun_proto || stack.getItem() == ModItems.gun_mirv) {

View File

@ -3,6 +3,7 @@ package com.hbm.util;
import java.util.List;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.recipes.anvil.AnvilRecipes.AnvilOutput;
import net.minecraft.entity.player.EntityPlayer;
@ -561,4 +562,58 @@ public class InventoryUtil {
return success;
}
public static int countAStackMatches(ItemStack[] inventory, AStack stack, boolean ignoreSize) {
int count = 0;
for(ItemStack itemStack : inventory) {
if(itemStack != null) {
if(stack.matchesRecipe(itemStack, true)) {
count += itemStack.stackSize;
}
}
}
return ignoreSize ? count : count / stack.stacksize;
}
public static int countAStackMatches(EntityPlayer player, AStack stack, boolean ignoreSize) {
return countAStackMatches(player.inventory.mainInventory, stack, ignoreSize);
}
public static boolean doesPlayerHaveAStack(EntityPlayer player, ComparableStack stack, boolean shouldRemove, boolean ignoreSize) {
return doesInventoryHaveAStack(player.inventory.mainInventory, stack, shouldRemove, ignoreSize);
}
public static boolean doesInventoryHaveAStack(ItemStack[] inventory, AStack stack, boolean shouldRemove, boolean ignoreSize)
{
final int totalMatches;
int totalStacks = 0;
for (ItemStack itemStack : inventory)
{
if (itemStack != null && stack.matchesRecipe(itemStack, ignoreSize))
totalStacks += itemStack.stackSize;
if (!shouldRemove && ignoreSize && totalStacks > 0)
return true;
}
totalMatches = ignoreSize ? totalStacks : totalStacks / stack.stacksize;
if (shouldRemove)
{
int consumedStacks = 0, requiredStacks = ignoreSize ? 1 : stack.stacksize;
for (ItemStack itemStack : inventory)
{
if (consumedStacks > requiredStacks)
break;
if (itemStack != null && stack.matchesRecipe(itemStack, true))
{
final int toConsume = Math.min(itemStack.stackSize, requiredStacks - consumedStacks);
itemStack.stackSize -= toConsume;
consumedStacks += toConsume;
}
}
}
return totalMatches > 0;
}
}