mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
repair kits, gun durability bar in HUD, recipes from old to new bullets
This commit is contained in:
parent
2dc71540a9
commit
add7fcc232
@ -131,6 +131,7 @@ chem.DYN_SCHRAB=Schrabidium-Dynosynthese
|
||||
chem.DYN_EUPH=Euphemium-Dynosynthese
|
||||
chem.DYN_DNT=Dineutronium-Dynosynthese
|
||||
chem.CORDITE=Korditherstellung
|
||||
chem.KEVLAR=Kevlarverbundherstellung
|
||||
|
||||
item.record.lc.desc=Valve - Diabolic Adrenaline Guitar/Lambda Core
|
||||
item.record.ss.desc=Valve - Sector Sweep
|
||||
@ -665,7 +666,7 @@ item.assembly_nightmare.name=Nightmare-Patronensatz
|
||||
item.assembly_pip.name=Verdorbener .44er Patronensatz
|
||||
item.assembly_nopip.name=.44er Patronensatz
|
||||
item.assembly_smg.name=9mm Patronensatz
|
||||
item.assembly_uzi.name=.22LR Patronensatz
|
||||
item.assembly_uzi.name=.22 LR Patronensatz
|
||||
item.assembly_calamity.name=.50 BMG Patronensatz
|
||||
item.assembly_lacunae.name=5mm Patronensatz
|
||||
|
||||
@ -1547,6 +1548,9 @@ item.jetpack_break.name=Bremsrucksack
|
||||
item.jetpack_vector.name=Schubvektorgesteuerter Raketenrucksack
|
||||
item.jetpack_tank.name=Raketenrucksack-Reservetank
|
||||
|
||||
item.gun_kit_1.name=Waffenöl
|
||||
item.gun_kit_2.name=Waffenreparatursatz
|
||||
|
||||
item.chainsaw.name=Kettensäge
|
||||
item.crowbar.name=Mk.V Kistenöffnungsapparat "Brechstange"
|
||||
|
||||
|
||||
@ -131,6 +131,7 @@ chem.DYN_SCHRAB=Schrabidium Dynosynthesis
|
||||
chem.DYN_EUPH=Euphemium Dynosynthesis
|
||||
chem.DYN_DNT=Dineutronium Dynosynthesis
|
||||
chem.CORDITE=Cordite Production
|
||||
chem.KEVLAR=Kevlar Compound Production
|
||||
|
||||
item.record.lc.desc=Valve - Diabolic Adrenaline Guitar/Lambda Core
|
||||
item.record.ss.desc=Valve - Sector Sweep
|
||||
@ -665,7 +666,7 @@ item.assembly_nightmare.name=Nightmare Bullet Assembly
|
||||
item.assembly_pip.name=Tainted Bullet Assembly
|
||||
item.assembly_nopip.name=.44 Magnum Assembly
|
||||
item.assembly_smg.name=9mm Assembly
|
||||
item.assembly_uzi.name=.22LR Assembly
|
||||
item.assembly_uzi.name=.22 LR Assembly
|
||||
item.assembly_calamity.name=.50 BMG Assembly
|
||||
item.assembly_lacunae.name=.5mm Assembly
|
||||
|
||||
@ -1547,6 +1548,9 @@ item.jetpack_break.name=Breakpack
|
||||
item.jetpack_vector.name=Vectored Jetpack
|
||||
item.jetpack_tank.name=Jetpack Reserve Fuel Tank
|
||||
|
||||
item.gun_kit_1.name=Gun Oil
|
||||
item.gun_kit_2.name=Gun Repair Kit
|
||||
|
||||
item.chainsaw.name=Chainsaw
|
||||
item.crowbar.name=Mk.V Crate Opening Device "Crowbar"
|
||||
|
||||
|
||||
@ -44,6 +44,8 @@
|
||||
"item.unpack": {"category": "player", "sounds": ["tool/extract1", "tool/extract2"]},
|
||||
"item.syringe": {"category": "player", "sounds": [{"name": "tool/stim", "stream": false}]},
|
||||
"item.radaway": {"category": "player", "sounds": [{"name": "tool/radaway", "stream": false}]},
|
||||
"item.spray": {"category": "player", "sounds": [{"name": "tool/spray", "stream": false}]},
|
||||
"item.repair": {"category": "player", "sounds": ["tool/repair1", "tool/repair2", "tool/repair3", "tool/repair4", "tool/repair5", "tool/repair6", "tool/repair7"]},
|
||||
|
||||
"music.recordLambdaCore": {"category": "record", "sounds": [{"name": "music/recordLambdaCore", "stream": true}]},
|
||||
"music.recordSectorSweep": {"category": "record", "sounds": [{"name": "music/recordSectorSweep", "stream": true}]},
|
||||
|
||||
BIN
assets/hbm/sounds/tool/repair1.ogg
Normal file
BIN
assets/hbm/sounds/tool/repair1.ogg
Normal file
Binary file not shown.
BIN
assets/hbm/sounds/tool/repair2.ogg
Normal file
BIN
assets/hbm/sounds/tool/repair2.ogg
Normal file
Binary file not shown.
BIN
assets/hbm/sounds/tool/repair3.ogg
Normal file
BIN
assets/hbm/sounds/tool/repair3.ogg
Normal file
Binary file not shown.
BIN
assets/hbm/sounds/tool/repair4.ogg
Normal file
BIN
assets/hbm/sounds/tool/repair4.ogg
Normal file
Binary file not shown.
BIN
assets/hbm/sounds/tool/repair5.ogg
Normal file
BIN
assets/hbm/sounds/tool/repair5.ogg
Normal file
Binary file not shown.
BIN
assets/hbm/sounds/tool/repair6.ogg
Normal file
BIN
assets/hbm/sounds/tool/repair6.ogg
Normal file
Binary file not shown.
BIN
assets/hbm/sounds/tool/repair7.ogg
Normal file
BIN
assets/hbm/sounds/tool/repair7.ogg
Normal file
Binary file not shown.
BIN
assets/hbm/sounds/tool/spray.ogg
Normal file
BIN
assets/hbm/sounds/tool/spray.ogg
Normal file
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 326 B After Width: | Height: | Size: 326 B |
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 4.8 KiB |
@ -25,7 +25,7 @@ public class Gun12GaugeFactory {
|
||||
config.reloadDuration = 10;
|
||||
config.firingDuration = 0;
|
||||
config.ammoCap = 6;
|
||||
config.durability = 2000;
|
||||
config.durability = 1500;
|
||||
config.reloadType = GunConfiguration.RELOAD_SINGLE;
|
||||
config.allowsInfinity = true;
|
||||
config.crosshair = Crosshair.L_CIRCLE;
|
||||
|
||||
@ -51,7 +51,7 @@ public class Gun20GaugeFactory {
|
||||
|
||||
GunConfiguration config = getShotgunConfig();
|
||||
|
||||
config.durability = 3500;
|
||||
config.durability = 2000;
|
||||
config.reloadSound = GunConfiguration.RSOUND_SHOTGUN;
|
||||
config.firingSound = "hbm:weapon.revolverShootAlt";
|
||||
config.firingPitch = 0.75F;
|
||||
@ -76,7 +76,7 @@ public class Gun20GaugeFactory {
|
||||
|
||||
GunConfiguration config = getShotgunConfig();
|
||||
|
||||
config.durability = 4000;
|
||||
config.durability = 2500;
|
||||
config.reloadSound = GunConfiguration.RSOUND_SHOTGUN;
|
||||
config.firingSound = "hbm:weapon.revolverShootAlt";
|
||||
config.firingPitch = 0.75F;
|
||||
@ -102,7 +102,7 @@ public class Gun20GaugeFactory {
|
||||
GunConfiguration config = getShotgunConfig();
|
||||
|
||||
config.ammoCap = 1;
|
||||
config.durability = 4000;
|
||||
config.durability = 3000;
|
||||
config.reloadSound = GunConfiguration.RSOUND_SHOTGUN;
|
||||
config.firingSound = "hbm:weapon.revolverShoot";
|
||||
config.firingPitch = 0.75F;
|
||||
@ -128,7 +128,7 @@ public class Gun20GaugeFactory {
|
||||
GunConfiguration config = getShotgunConfig();
|
||||
|
||||
config.ammoCap = 1;
|
||||
config.durability = 3500;
|
||||
config.durability = 2500;
|
||||
config.reloadSound = GunConfiguration.RSOUND_SHOTGUN;
|
||||
config.firingSound = "hbm:weapon.revolverShoot";
|
||||
config.firingPitch = 0.75F;
|
||||
|
||||
@ -28,7 +28,7 @@ public class Gun22LRFactory {
|
||||
config.reloadType = GunConfiguration.RELOAD_FULL;
|
||||
config.allowsInfinity = true;
|
||||
config.crosshair = Crosshair.L_CROSS;
|
||||
config.durability = 2000;
|
||||
config.durability = 3000;
|
||||
config.reloadSound = GunConfiguration.RSOUND_MAG;
|
||||
config.firingSound = "hbm:weapon.uziShoot";
|
||||
|
||||
@ -46,7 +46,7 @@ public class Gun22LRFactory {
|
||||
|
||||
GunConfiguration config = getUziConfig();
|
||||
|
||||
config.durability = 3500;
|
||||
config.durability = 4500;
|
||||
|
||||
config.name = "IMI Uzi D-25A";
|
||||
config.manufacturer = "IMI / Big MT";
|
||||
|
||||
@ -97,7 +97,7 @@ public class Gun5mmFactory {
|
||||
bullet.spread *= inaccuracy;
|
||||
bullet.dmgMin = 4;
|
||||
bullet.dmgMax = 7;
|
||||
bullet.explosive = 0.5F;
|
||||
bullet.explosive = 1F;
|
||||
bullet.wear = 25;
|
||||
|
||||
return bullet;
|
||||
|
||||
@ -5319,10 +5319,10 @@ public class MachineRecipes {
|
||||
input[0] = new FluidStack(800, FluidType.PETROLEUM);
|
||||
break;
|
||||
case CC_OIL:
|
||||
input[0] = new FluidStack(1000, FluidType.OIL);
|
||||
input[0] = new FluidStack(2000, FluidType.OIL);
|
||||
break;
|
||||
case CC_I:
|
||||
input[0] = new FluidStack(800, FluidType.SMEAR);
|
||||
input[0] = new FluidStack(1600, FluidType.SMEAR);
|
||||
break;
|
||||
case CC_HEATING:
|
||||
input[0] = new FluidStack(1800, FluidType.HEATINGOIL);
|
||||
|
||||
@ -8,6 +8,7 @@ import com.hbm.handler.guncfg.Gun22LRFactory;
|
||||
import com.hbm.handler.guncfg.Gun357MagnumFactory;
|
||||
import com.hbm.handler.guncfg.Gun44MagnumFactory;
|
||||
import com.hbm.handler.guncfg.Gun50BMGFactory;
|
||||
import com.hbm.handler.guncfg.Gun5mmFactory;
|
||||
import com.hbm.handler.guncfg.Gun9mmFactory;
|
||||
import com.hbm.handler.guncfg.GunGrenadeFactory;
|
||||
import com.hbm.handler.guncfg.GunRocketFactory;
|
||||
@ -582,6 +583,8 @@ public class ModItems {
|
||||
public static Item stealth_boy;
|
||||
public static Item gas_mask_filter;
|
||||
public static Item jetpack_tank;
|
||||
public static Item gun_kit_1;
|
||||
public static Item gun_kit_2;
|
||||
|
||||
public static Item can_empty;
|
||||
public static Item can_smart;
|
||||
@ -2050,6 +2053,8 @@ public class ModItems {
|
||||
stealth_boy = new ItemStarterKit().setUnlocalizedName("stealth_boy").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":stealth_boy");
|
||||
gas_mask_filter = new ItemSyringe().setUnlocalizedName("gas_mask_filter").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":gas_mask_filter");
|
||||
jetpack_tank = new ItemSyringe().setUnlocalizedName("jetpack_tank").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":jetpack_tank");
|
||||
gun_kit_1 = new ItemSyringe().setUnlocalizedName("gun_kit_1").setMaxStackSize(16).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":gun_kit_1");
|
||||
gun_kit_2 = new ItemSyringe().setUnlocalizedName("gun_kit_2").setMaxStackSize(16).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":gun_kit_2");
|
||||
|
||||
can_empty = new Item().setUnlocalizedName("can_empty").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":can_empty");
|
||||
can_smart = new ItemEnergy().setUnlocalizedName("can_smart").setContainerItem(ModItems.can_empty).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":can_smart");
|
||||
@ -2313,7 +2318,7 @@ public class ModItems {
|
||||
|
||||
gun_rpg = new ItemGunBase(GunRocketFactory.getGustavConfig()).setUnlocalizedName("gun_rpg").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_rpg");
|
||||
gun_rpg_ammo = new Item().setUnlocalizedName("gun_rpg_ammo").setCreativeTab(null).setTextureName(RefStrings.MODID + ":gun_rpg_ammo_alt");
|
||||
gun_hk69 = new ItemGunBase(GunGrenadeFactory.getHK69Config()).setUnlocalizedName("gun_hk69").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_hk69");
|
||||
gun_hk69 = new ItemGunBase(GunGrenadeFactory.getHK69Config()).setFull3D().setUnlocalizedName("gun_hk69").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_hk69");
|
||||
gun_stinger = new GunStinger().setUnlocalizedName("gun_stinger").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_stinger");
|
||||
gun_skystinger = new GunStinger().setUnlocalizedName("gun_skystinger").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_skystinger");
|
||||
gun_stinger_ammo = new Item().setUnlocalizedName("gun_stinger_ammo").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_stinger_ammo");
|
||||
@ -2345,9 +2350,9 @@ public class ModItems {
|
||||
gun_calamity = new ItemGunBase(Gun50BMGFactory.getCalamityConfig()).setUnlocalizedName("gun_calamity").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_calamity");
|
||||
gun_calamity_dual = new ItemGunBase(Gun50BMGFactory.getSaddleConfig()).setUnlocalizedName("gun_calamity_dual").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_calamity_dual");
|
||||
gun_lacunae_ammo = new ItemCustomLore().setUnlocalizedName("gun_lacunae_ammo").setCreativeTab(null).setTextureName(RefStrings.MODID + ":gun_lacunae_ammo");
|
||||
gun_minigun = new GunLacunae().setUnlocalizedName("gun_minigun").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_minigun");
|
||||
gun_avenger = new GunLacunae().setUnlocalizedName("gun_avenger").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_avenger");
|
||||
gun_lacunae = new GunLacunae().setUnlocalizedName("gun_lacunae").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_lacunae");
|
||||
gun_minigun = new ItemGunBase(Gun5mmFactory.get53Config()).setUnlocalizedName("gun_minigun").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_minigun");
|
||||
gun_avenger = new ItemGunBase(Gun5mmFactory.get57Config()).setUnlocalizedName("gun_avenger").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_avenger");
|
||||
gun_lacunae = new ItemGunBase(Gun5mmFactory.getLacunaeConfig()).setUnlocalizedName("gun_lacunae").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_lacunae");
|
||||
gun_folly = new GunFolly().setUnlocalizedName("gun_folly").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_folly");
|
||||
gun_fatman_ammo = new Item().setUnlocalizedName("gun_fatman_ammo").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_fatman_ammo");
|
||||
gun_fatman = new GunFatman().setMaxDamage(2500).setUnlocalizedName("gun_fatman").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_fatman");
|
||||
@ -4242,6 +4247,8 @@ public class ModItems {
|
||||
GameRegistry.registerItem(stealth_boy, stealth_boy.getUnlocalizedName());
|
||||
GameRegistry.registerItem(gas_mask_filter, gas_mask_filter.getUnlocalizedName());
|
||||
GameRegistry.registerItem(jetpack_tank, jetpack_tank.getUnlocalizedName());
|
||||
GameRegistry.registerItem(gun_kit_1, gun_kit_1.getUnlocalizedName());
|
||||
GameRegistry.registerItem(gun_kit_2, gun_kit_2.getUnlocalizedName());
|
||||
|
||||
//Food
|
||||
GameRegistry.registerItem(bomb_waffle, bomb_waffle.getUnlocalizedName());
|
||||
|
||||
@ -8,6 +8,7 @@ import com.hbm.items.gear.JetpackBooster;
|
||||
import com.hbm.items.gear.JetpackBreak;
|
||||
import com.hbm.items.gear.JetpackRegular;
|
||||
import com.hbm.items.gear.JetpackVectorized;
|
||||
import com.hbm.items.weapon.ItemGunBase;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.saveddata.RadEntitySavedData;
|
||||
@ -335,6 +336,45 @@ public class ItemSyringe extends Item {
|
||||
}
|
||||
}
|
||||
|
||||
if(this == ModItems.gun_kit_1 || this == ModItems.gun_kit_2)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
for(int i = 0; i < 9; i++) {
|
||||
|
||||
ItemStack gun = player.inventory.mainInventory[i];
|
||||
|
||||
if(gun != null && gun.getItem() instanceof ItemGunBase) {
|
||||
|
||||
float repair = 0;
|
||||
|
||||
if(this == ModItems.gun_kit_1) {
|
||||
repair = 0.1F;
|
||||
world.playSoundAtEntity(player, "hbm:item.spray", 1.0F, 1.0F);
|
||||
}
|
||||
if(this == ModItems.gun_kit_2) {
|
||||
repair = 0.5F;
|
||||
world.playSoundAtEntity(player, "hbm:item.repair", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
int full = ((ItemGunBase)gun.getItem()).mainConfig.durability;
|
||||
int wear = ItemGunBase.getItemWear(gun);
|
||||
|
||||
int nWear = (int) (wear - (full * repair));
|
||||
|
||||
if(nWear < 0)
|
||||
nWear = 0;
|
||||
|
||||
System.out.println(wear + " " + nWear);
|
||||
|
||||
ItemGunBase.setItemWear(gun, nWear);
|
||||
}
|
||||
}
|
||||
|
||||
stack.stackSize--;
|
||||
}
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@ -609,5 +649,11 @@ public class ItemSyringe extends Item {
|
||||
if(this == ModItems.jetpack_tank) {
|
||||
list.add("Fills worn jetpack with up to 1000mB of kerosene");
|
||||
}
|
||||
if(this == ModItems.gun_kit_1) {
|
||||
list.add("Repairs all weapons in hotbar by 10%");
|
||||
}
|
||||
if(this == ModItems.gun_kit_2) {
|
||||
list.add("Repairs all weapons in hotbar by 50%");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,6 +23,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@ -55,10 +57,15 @@ public class ItemGunBase extends Item implements IHoldableWeapon {
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isCurrentItem) {
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT && entity instanceof EntityPlayer && world.isRemote) {
|
||||
updateClient(stack, world, (EntityPlayer)entity, slot, isCurrentItem);
|
||||
} else {
|
||||
updateServer(stack, world, (EntityPlayer)entity, slot, isCurrentItem);
|
||||
//if(!isCurrentItem)
|
||||
// return;
|
||||
|
||||
if(entity instanceof EntityPlayer) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT && world.isRemote) {
|
||||
updateClient(stack, world, (EntityPlayer)entity, slot, isCurrentItem);
|
||||
} else if(isCurrentItem) {
|
||||
updateServer(stack, world, (EntityPlayer)entity, slot, isCurrentItem);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -105,7 +112,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon {
|
||||
m2 = false;
|
||||
}
|
||||
|
||||
if(mainConfig.reloadType != 0 || (altConfig != null && altConfig.reloadType != 0)) {
|
||||
if(mainConfig.reloadType != mainConfig.RELOAD_NONE || (altConfig != null && altConfig.reloadType != 0)) {
|
||||
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_R) && getMag(stack) < mainConfig.ammoCap) {
|
||||
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(true, (byte) 2));
|
||||
@ -126,55 +133,82 @@ public class ItemGunBase extends Item implements IHoldableWeapon {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateServer(ItemStack stack, World world, EntityPlayer entity, int slot, boolean isCurrentItem) {
|
||||
private void updateServer(ItemStack stack, World world, EntityPlayer player, int slot, boolean isCurrentItem) {
|
||||
|
||||
if(getDelay(stack) > 0)
|
||||
if(getDelay(stack) > 0 && isCurrentItem)
|
||||
setDelay(stack, getDelay(stack) - 1);
|
||||
|
||||
if(mainConfig.firingMode == 1 && getIsMouseDown(stack) && getDelay(stack) == 0 && getMag(stack) > 0 && !getIsReloading(stack)) {
|
||||
fire(stack, world, entity);
|
||||
if(mainConfig.firingMode == 1 && getIsMouseDown(stack) && tryShoot(stack, world, player, isCurrentItem)) {
|
||||
|
||||
fire(stack, world, player);
|
||||
setDelay(stack, mainConfig.rateOfFire);
|
||||
setMag(stack, getMag(stack) - 1);
|
||||
//setMag(stack, getMag(stack) - 1);
|
||||
useUpAmmo(player, stack);
|
||||
}
|
||||
|
||||
if(getIsReloading(stack)) {
|
||||
reload(stack, world, entity);
|
||||
if(getIsReloading(stack) && isCurrentItem) {
|
||||
reload(stack, world, player);
|
||||
}
|
||||
}
|
||||
|
||||
//tries to shoot, bullet checks are done here
|
||||
private boolean tryShoot(ItemStack stack, World world, EntityPlayer player, boolean main) {
|
||||
|
||||
if(getDelay(stack) == 0 && !getIsReloading(stack) && getItemWear(stack) < mainConfig.durability) {
|
||||
|
||||
if(mainConfig.reloadType == mainConfig.RELOAD_NONE) {
|
||||
return getBeltSize(player, getBeltType(player, stack)) > 0;
|
||||
|
||||
} else {
|
||||
return getMag(stack) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//called every time the gun shoots, overridden to change bullet entity/special additions
|
||||
private void fire(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
BulletConfiguration config = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
|
||||
BulletConfiguration config = null;
|
||||
|
||||
if(mainConfig.reloadType == mainConfig.RELOAD_NONE) {
|
||||
config = getBeltCfg(player, stack);
|
||||
} else {
|
||||
config = BulletConfigSyncingUtil.pullConfig(mainConfig.config.get(getMagType(stack)));
|
||||
}
|
||||
|
||||
int bullets = config.bulletsMin;
|
||||
|
||||
if(config.bulletsMax > config.bulletsMin)
|
||||
bullets += world.rand.nextInt(config.bulletsMax - config.bulletsMin);
|
||||
|
||||
for(int i = 0; i < bullets; i++) {
|
||||
EntityBulletBase bullet = new EntityBulletBase(world, mainConfig.config.get(getMagType(stack)), player);
|
||||
world.spawnEntityInWorld(bullet);
|
||||
for(int k = 0; k < mainConfig.roundsPerCycle; k++) {
|
||||
if(config.bulletsMax > config.bulletsMin)
|
||||
bullets += world.rand.nextInt(config.bulletsMax - config.bulletsMin);
|
||||
|
||||
for(int i = 0; i < bullets; i++) {
|
||||
spawnProjectile(world, player, stack, BulletConfigSyncingUtil.getKey(config));
|
||||
}
|
||||
|
||||
setItemWear(stack, getItemWear(stack) + config.wear);
|
||||
}
|
||||
|
||||
setItemWear(stack, getItemWear(stack) + config.wear);
|
||||
world.playSoundAtEntity(player, mainConfig.firingSound, 1.0F, mainConfig.firingPitch);
|
||||
|
||||
//player.inventory.addItemStackToInventory(new ItemStack(ModItems.gun_revolver_gold_ammo));
|
||||
}
|
||||
|
||||
private void spawnProjectile(World world, EntityPlayer player, ItemStack stack, int config) {
|
||||
|
||||
EntityBulletBase bullet = new EntityBulletBase(world, config, player);
|
||||
world.spawnEntityInWorld(bullet);
|
||||
}
|
||||
|
||||
//called on click (server side, called by mouse packet)
|
||||
public void startAction(ItemStack stack, World world, EntityPlayer player, boolean main) {
|
||||
|
||||
if(mainConfig.firingMode == 0 && getIsMouseDown(stack) && getDelay(stack) == 0 && getMag(stack) > 0 && !getIsReloading(stack)) {
|
||||
if(mainConfig.firingMode == mainConfig.FIRE_MANUAL && getIsMouseDown(stack) && tryShoot(stack, world, player, main)) {
|
||||
fire(stack, world, player);
|
||||
setDelay(stack, mainConfig.rateOfFire);
|
||||
setMag(stack, getMag(stack) - 1);
|
||||
//setMag(stack, getMag(stack) - 1);
|
||||
useUpAmmo(player, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@ -309,6 +343,66 @@ public class ItemGunBase extends Item implements IHoldableWeapon {
|
||||
}
|
||||
}
|
||||
|
||||
public static Item getBeltType(EntityPlayer player, ItemStack stack) {
|
||||
|
||||
ItemGunBase gun = (ItemGunBase)stack.getItem();
|
||||
Item ammo = BulletConfigSyncingUtil.pullConfig(gun.mainConfig.config.get(0)).ammo;
|
||||
|
||||
for(Integer config : gun.mainConfig.config) {
|
||||
|
||||
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config);
|
||||
|
||||
if(player.inventory.hasItem(cfg.ammo)) {
|
||||
ammo = cfg.ammo;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ammo;
|
||||
}
|
||||
|
||||
public static BulletConfiguration getBeltCfg(EntityPlayer player, ItemStack stack) {
|
||||
|
||||
ItemGunBase gun = (ItemGunBase)stack.getItem();
|
||||
Item ammo = getBeltType(player, stack);
|
||||
|
||||
for(Integer config : gun.mainConfig.config) {
|
||||
|
||||
BulletConfiguration cfg = BulletConfigSyncingUtil.pullConfig(config);
|
||||
|
||||
if(player.inventory.hasItem(cfg.ammo)) {
|
||||
return cfg;
|
||||
}
|
||||
}
|
||||
|
||||
return BulletConfigSyncingUtil.pullConfig(gun.mainConfig.config.get(0));
|
||||
}
|
||||
|
||||
public static int getBeltSize(EntityPlayer player, Item ammo) {
|
||||
|
||||
int amount = 0;
|
||||
|
||||
for(ItemStack stack : player.inventory.mainInventory) {
|
||||
if(stack != null && stack.getItem() == ammo)
|
||||
amount += stack.stackSize;
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void useUpAmmo(EntityPlayer player, ItemStack stack) {
|
||||
|
||||
if(mainConfig.allowsInfinity && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0)
|
||||
return;
|
||||
|
||||
for(int k = 0; k < mainConfig.roundsPerCycle; k++) {
|
||||
if(mainConfig.reloadType != mainConfig.RELOAD_NONE)
|
||||
setMag(stack, getMag(stack) - 1);
|
||||
else
|
||||
player.inventory.consumeInventoryItem(getBeltType(player, stack));
|
||||
}
|
||||
}
|
||||
|
||||
/*//returns main config from itemstack
|
||||
public static GunConfiguration extractConfig(ItemStack stack) {
|
||||
|
||||
@ -360,7 +454,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon {
|
||||
return readNBT(stack, "dlay");
|
||||
}
|
||||
|
||||
/// RoF cooldown ///
|
||||
/// Gun wear ///
|
||||
public static void setItemWear(ItemStack stack, int i) {
|
||||
writeNBT(stack, "wear", i);
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ public class HbmChestContents {
|
||||
new WeightedRandomChestContent(ModItems.circuit_targeting_tier1, 0, 1, 1, 5),
|
||||
new WeightedRandomChestContent(ModItems.gun_revolver, 0, 1, 1, 3),
|
||||
new WeightedRandomChestContent(ModItems.gun_revolver_ammo, 0, 2, 6, 4),
|
||||
new WeightedRandomChestContent(ModItems.gun_kit_1, 0, 1, 3, 4),
|
||||
new WeightedRandomChestContent(ModItems.gun_lever_action, 0, 1, 1, 1),
|
||||
new WeightedRandomChestContent(ModItems.ammo_20gauge, 0, 2, 6, 3),
|
||||
new WeightedRandomChestContent(ModItems.battery_generic, 0, 1, 1, 4),
|
||||
@ -77,6 +78,8 @@ public class HbmChestContents {
|
||||
new WeightedRandomChestContent(ModItems.gun_revolver_gold_ammo, 0, 1, 6, 5),
|
||||
new WeightedRandomChestContent(ModItems.gun_revolver_lead, 0, 1, 1, 4),
|
||||
new WeightedRandomChestContent(ModItems.gun_revolver_lead_ammo, 0, 1, 6, 5),
|
||||
new WeightedRandomChestContent(ModItems.gun_kit_1, 0, 1, 3, 6),
|
||||
new WeightedRandomChestContent(ModItems.gun_kit_2, 0, 1, 2, 3),
|
||||
new WeightedRandomChestContent(ModItems.gun_rpg, 0, 1, 1, 4),
|
||||
new WeightedRandomChestContent(ModItems.ammo_rocket, 0, 1, 4, 5),
|
||||
new WeightedRandomChestContent(ModItems.gun_fatman, 0, 1, 1, 1),
|
||||
@ -158,6 +161,7 @@ public class HbmChestContents {
|
||||
new WeightedRandomChestContent(ModItems.fusion_core, 0, 1, 1, 10),
|
||||
new WeightedRandomChestContent(ModItems.gun_revolver, 0, 1, 1, 4),
|
||||
new WeightedRandomChestContent(ModItems.gun_revolver_ammo, 0, 1, 24, 4),
|
||||
new WeightedRandomChestContent(ModItems.gun_kit_1, 0, 2, 3, 4),
|
||||
new WeightedRandomChestContent(ModItems.gun_rpg, 0, 1, 1, 3),
|
||||
new WeightedRandomChestContent(ModItems.ammo_rocket, 0, 1, 6, 3),
|
||||
new WeightedRandomChestContent(ModItems.rod_uranium_fuel, 0, 1, 1, 2),
|
||||
|
||||
@ -811,7 +811,7 @@ public class CraftingManager {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gun_emp_ammo, 8), new Object[] { "IGI", "IPI", "IPI", 'G', "plateGold", 'I', "plateIron", 'P', ModItems.powder_power }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gun_jack, 1), new Object[] { "WW ", "TSD", " TT", 'W', "ingotWeidanium", 'T', ModItems.toothpicks, 'S', ModItems.gun_uboinik, 'D', ModItems.ducttape }));
|
||||
//GameRegistry.addShapedRecipe(new ItemStack(ModItems.gun_jack_ammo, 3), new Object[] { "PP", "II", "GG", 'G', Items.gunpowder, 'P', ModItems.pellet_buckshot, 'I', ModItems.plate_polymer });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.gun_jack_ammo, 1), new Object[] { ModItems.gun_uboinik_ammo, ModItems.gun_uboinik_ammo, ModItems.gun_uboinik_ammo, ModItems.gun_uboinik_ammo });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.gun_jack_ammo, 1), new Object[] { ModItems.gun_uboinik_ammo, ModItems.gun_uboinik_ammo, ModItems.gun_uboinik_ammo, ModItems.ammo_12gauge });
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gun_euthanasia, 1), new Object[] { "TDT", "AAS", " T ", 'A', "ingotAustralium", 'T', ModItems.toothpicks, 'S', ModItems.gun_mp40, 'D', ModItems.ducttape }));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(ModItems.gun_euthanasia_ammo, 12), new Object[] { "P", "S", "N", 'P', ModItems.powder_poison, 'N', ModItems.niter, 'S', ModItems.syringe_metal_empty });
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gun_spark, 1), new Object[] { "TTD", "AAS", " T", 'A', "ingotDaffergon", 'T', ModItems.toothpicks, 'S', ModItems.gun_rpg, 'D', ModItems.ducttape }));
|
||||
@ -837,6 +837,17 @@ public class CraftingManager {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gun_uzi_saturnite_silencer, 1), new Object[] { "P ", " P ", " U", 'P', "ingotPolymer", 'U', ModItems.gun_uzi_saturnite }));
|
||||
//GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gun_uzi_ammo, 16), new Object[] { "L", "P", "G", 'P', "plateIron", 'L', "plateSteel", 'G', Items.gunpowder }));
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ammo_44, 1), new Object[] { ModItems.gun_revolver_nopip_ammo });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ammo_44_pip, 1), new Object[] { ModItems.gun_revolver_pip_ammo });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ammo_50bmg, 1), new Object[] { ModItems.gun_calamity_ammo });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ammo_5mm, 1), new Object[] { ModItems.gun_lacunae_ammo });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ammo_rocket, 1), new Object[] { ModItems.gun_rpg_ammo });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ammo_9mm, 1), new Object[] { ModItems.gun_mp40_ammo });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ammo_22lr, 1), new Object[] { ModItems.gun_uzi_ammo });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ammo_12gauge, 1), new Object[] { ModItems.gun_uboinik_ammo });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ammo_20gauge, 1), new Object[] { ModItems.gun_lever_action_ammo });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ammo_20gauge_slug, 1), new Object[] { ModItems.gun_bolt_action_ammo });
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.pellet_flechette, 1), new Object[] { " L ", " L ", "LLL", 'L', "nuggetLead" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.assembly_iron, 16), new Object[] { " I", "GC", " P", 'I', "ingotIron", 'G', ModItems.cordite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.assembly_steel, 16), new Object[] { " I", "GC", " P", 'I', "ingotLead", 'G', ModItems.cordite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }));
|
||||
@ -1267,6 +1278,8 @@ public class CraftingManager {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gas_mask_m65, 1), new Object[] { "PPP", "GPG", " F ", 'G', "paneGlass", 'P', ModItems.plate_polymer, 'F', ModItems.gas_mask_filter }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gas_mask_filter, 1), new Object[] { "F", "I", "F", 'F', ModItems.filter_coal, 'I', "plateIron" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.jetpack_tank, 1), new Object[] { " S ", "BKB", " S ", 'S', "plateSteel", 'B', ModItems.bolt_tungsten, 'K', ModItems.canister_kerosene }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gun_kit_1, 4), new Object[] { "I ", "LB", "P ", 'I', ModItems.plate_polymer, 'L', ModItems.canister_canola, 'B', ModItems.bolt_tungsten, 'P', "plateIron" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gun_kit_2, 1), new Object[] { "III", "GLG", "PPP", 'I', ModItems.plate_polymer, 'L', ModItems.ducttape, 'G', ModItems.gun_kit_1, 'P', "plateIron" }));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.cape_radiation, 1), new Object[] { "W W", "WIW", "WDW", 'W', new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), 'D', new ItemStack(Items.dye, 1, 11), 'I', ModItems.nuclear_waste });
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.cape_gasmask, 1), new Object[] { "W W", "WIW", "WDW", 'W', new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), 'D', new ItemStack(Items.dye, 1, 0), 'I', ModItems.gas_mask });
|
||||
|
||||
@ -55,7 +55,15 @@ public class ModEventHandlerClient {
|
||||
int count = ItemGunBase.getMag(player.getHeldItem());
|
||||
int max = gcfg.ammoCap;
|
||||
|
||||
RenderScreenOverlay.renderAmmo(event.resolution, Minecraft.getMinecraft().ingameGUI, ammo, count, max);
|
||||
if(gcfg.reloadType == gcfg.RELOAD_NONE) {
|
||||
ammo = ItemGunBase.getBeltType(player, player.getHeldItem());
|
||||
count = ItemGunBase.getBeltSize(player, ammo);
|
||||
max = -1;
|
||||
}
|
||||
|
||||
int dura = ItemGunBase.getItemWear(player.getHeldItem()) * 50 / gcfg.durability;
|
||||
|
||||
RenderScreenOverlay.renderAmmo(event.resolution, Minecraft.getMinecraft().ingameGUI, ammo, count, max, dura);
|
||||
//RenderScreenOverlay.renderRadCounter(event.resolution, 0, Minecraft.getMinecraft().ingameGUI);
|
||||
|
||||
}
|
||||
|
||||
@ -109,16 +109,22 @@ public class RenderScreenOverlay {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(hud);
|
||||
}
|
||||
|
||||
public static void renderAmmo(ScaledResolution resolution, Gui gui, Item ammo, int count, int max) {
|
||||
public static void renderAmmo(ScaledResolution resolution, Gui gui, Item ammo, int count, int max, int dura) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
int pX = resolution.getScaledWidth() / 2 + 62 + 36;
|
||||
int pZ = resolution.getScaledHeight() - 19;
|
||||
int pZ = resolution.getScaledHeight() - 21;
|
||||
|
||||
Minecraft.getMinecraft().fontRenderer.drawString("x" + count, pX + 14, pZ + 6, 0xFFFFFF);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(misc);
|
||||
gui.drawTexturedModalRect(pX, pZ + 16, 94, 0, 52, 3);
|
||||
gui.drawTexturedModalRect(pX + 1, pZ + 16, 95, 3, 50 - dura, 3);
|
||||
|
||||
String cap = max == -1 ? ("∞") : ("" + max);
|
||||
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(count + " / " + cap, pX + 16, pZ + 6, 0xFFFFFF);
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user