diff --git a/src/main/java/com/hbm/entity/projectile/EntityBulletBase.java b/src/main/java/com/hbm/entity/projectile/EntityBulletBase.java index 7e551326d..2cd1bd70f 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityBulletBase.java +++ b/src/main/java/com/hbm/entity/projectile/EntityBulletBase.java @@ -25,6 +25,7 @@ import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.ReflectionHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -252,7 +253,9 @@ public class EntityBulletBase extends Entity implements IProjectile { MovingObjectPosition movement = this.worldObj.func_147447_a(vecOrigin, vecDestination, false, true, false); vecOrigin = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); vecDestination = Vec3.createVectorHelper(this.posX + this.motionX * this.config.velocity, this.posY + this.motionY * this.config.velocity, this.posZ + this.motionZ * this.config.velocity); - + + MovingObjectPosition impact = null; + Entity victim = null; List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX * this.config.velocity, this.motionY * this.config.velocity, this.motionZ * this.config.velocity).expand(1.0D, 1.0D, 1.0D)); @@ -273,6 +276,7 @@ public class EntityBulletBase extends Entity implements IProjectile { if (d1 < d0 || d0 == 0.0D) { victim = entity1; + impact = movingobjectposition1; d0 = d1; } } @@ -295,25 +299,29 @@ public class EntityBulletBase extends Entity implements IProjectile { DamageSource damagesource = this.config.getDamage(this, shooter); - if(!worldObj.isRemote) { - if(!config.doesPenetrate) { + if(!worldObj.isRemote) { + if(!config.doesPenetrate) { this.setPosition(movement.hitVec.xCoord, movement.hitVec.yCoord, movement.hitVec.zCoord); - onEntityImpact(victim); - } else { - onEntityHurt(victim); - } - } + onEntityImpact(victim); + } else { + onEntityHurt(victim); + } + } float damage = rand.nextFloat() * (config.dmgMax - config.dmgMin) + config.dmgMin; if(overrideDamage != 0) damage = overrideDamage; + boolean headshot = false; + if(victim instanceof EntityLivingBase) { EntityLivingBase living = (EntityLivingBase) victim; double head = living.height - living.getEyeHeight(); - if(movement.hitVec != null && movement.hitVec.yCoord > living.height - head) { + + if(!!living.isEntityAlive() && impact.hitVec != null && impact.hitVec.yCoord > (living.posY + living.height - head * 2)) { damage *= this.config.headshotMult; + headshot = true; } } @@ -324,8 +332,26 @@ public class EntityBulletBase extends Entity implements IProjectile { float dmg = (float) damage + lastDamage.getFloat(victim); - victim.attackEntityFrom(damagesource, dmg); + if(!victim.attackEntityFrom(damagesource, dmg)) { + headshot = false; + } } catch (Exception x) { } + + } + + if(!worldObj.isRemote && headshot) { + if(victim instanceof EntityLivingBase) { + EntityLivingBase living = (EntityLivingBase) victim; + double head = living.height - living.getEyeHeight(); + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "vanillaburst"); + data.setInteger("count", 15); + data.setDouble("motion", 0.1D); + data.setString("mode", "blockdust"); + data.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block)); + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, living.posX, living.posY + living.height - head, living.posZ), new TargetPoint(living.dimension, living.posX, living.posY, living.posZ, 50)); + worldObj.playSoundEffect(victim.posX, victim.posY, victim.posZ, "mob.zombie.woodbreak", 1.0F, 0.95F + rand.nextFloat() * 0.2F); + } } //handle block collision diff --git a/src/main/java/com/hbm/handler/BulletConfigSyncingUtil.java b/src/main/java/com/hbm/handler/BulletConfigSyncingUtil.java index 0386fa2c1..75d8d5188 100644 --- a/src/main/java/com/hbm/handler/BulletConfigSyncingUtil.java +++ b/src/main/java/com/hbm/handler/BulletConfigSyncingUtil.java @@ -24,6 +24,11 @@ public class BulletConfigSyncingUtil { public static int NIGHT2_REVOLVER = i++; public static int SATURNITE_REVOLVER = i++; public static int DESH_REVOLVER = i++; + + public static int IRON_HS = i++; + public static int STEEL_HS = i++; + public static int GOLD_HS = i++; + public static int DESH_HS = i++; public static int G20_NORMAL = i++; public static int G20_SLUG = i++; @@ -276,6 +281,11 @@ public class BulletConfigSyncingUtil { configSet.put(SATURNITE_REVOLVER, Gun357MagnumFactory.getRevSteelConfig().setToFire(3)); configSet.put(DESH_REVOLVER, Gun357MagnumFactory.getRevDeshConfig()); + configSet.put(IRON_HS, Gun357MagnumFactory.getRevIronConfig().setHeadshot(3F)); + configSet.put(STEEL_HS, Gun357MagnumFactory.getRevSteelConfig().setHeadshot(3F)); + configSet.put(GOLD_HS, Gun357MagnumFactory.getRevGoldConfig().setHeadshot(3F)); + configSet.put(DESH_HS, Gun357MagnumFactory.getRevDeshConfig().setHeadshot(3F)); + configSet.put(G20_NORMAL, Gun20GaugeFactory.get20GaugeConfig()); configSet.put(G20_SLUG, Gun20GaugeFactory.get20GaugeSlugConfig()); configSet.put(G20_FLECHETTE, Gun20GaugeFactory.get20GaugeFlechetteConfig()); @@ -514,7 +524,6 @@ public class BulletConfigSyncingUtil { } public static BulletConfiguration pullConfig(int key) { - return configSet.get(key); } diff --git a/src/main/java/com/hbm/handler/guncfg/Gun357MagnumFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun357MagnumFactory.java index 9cacf7258..7aed32486 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun357MagnumFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun357MagnumFactory.java @@ -185,6 +185,27 @@ public class Gun357MagnumFactory { return config; } + public static GunConfiguration getRevolverBioConfig() { + + GunConfiguration config = getBaseConfig(); + + config.durability = 100000; + config.firingSound = "hbm:weapon.deagleShoot"; + config.reloadDuration = 53; + config.crosshair = Crosshair.CIRCLE; + + config.name = "RI No. 2 Mark 1"; + config.manufacturer = "Ryan Industries"; + + config.config = new ArrayList(); + config.config.add(BulletConfigSyncingUtil.IRON_HS); + config.config.add(BulletConfigSyncingUtil.STEEL_HS); + config.config.add(BulletConfigSyncingUtil.GOLD_HS); + config.config.add(BulletConfigSyncingUtil.DESH_HS); + + return config; + } + //// // // // // ////// ////// ////// // // // // // // // // // //// // // // // //// // ////// diff --git a/src/main/java/com/hbm/inventory/fluid/Fluids.java b/src/main/java/com/hbm/inventory/fluid/Fluids.java index d77597286..7592f4a0e 100644 --- a/src/main/java/com/hbm/inventory/fluid/Fluids.java +++ b/src/main/java/com/hbm/inventory/fluid/Fluids.java @@ -151,7 +151,7 @@ public class Fluids { CRYOGEL = new FluidType( "CRYOGEL", 0x32ffff, 2, 0, 0, EnumSymbol.CROYGENIC).setTemp(-170); HYDROGEN = new FluidTypeCombustible( "HYDROGEN", 0x4286f4, 3, 4, 0, EnumSymbol.CROYGENIC).setCombustionEnergy(FuelGrade.HIGH, 10_000).setHeatEnergy(5_000).addTraits(FluidTrait.LIQUID); OXYGEN = new FluidType( "OXYGEN", 0x98bdf9, 3, 0, 0, EnumSymbol.CROYGENIC); - XENON = new FluidType( "XENON", 0xba45e8, 0, 0, 0, EnumSymbol.ASPHYXIANT); + XENON = new Gas( "XENON", 0xba45e8, 0, 0, 0, EnumSymbol.ASPHYXIANT); BALEFIRE = new FluidType( "BALEFIRE", 0x28e02e, 4, 4, 3, EnumSymbol.RADIATION).setTemp(1500).addTraits(FluidTrait.CORROSIVE); MERCURY = new FluidType( "MERCURY", 0x808080, 2, 0, 0, EnumSymbol.NONE); PAIN = new FluidType( "PAIN", 0x938541, 2, 0, 1, EnumSymbol.ACID).setTemp(300).addTraits(FluidTrait.CORROSIVE); diff --git a/src/main/java/com/hbm/inventory/gui/GUITurretArty.java b/src/main/java/com/hbm/inventory/gui/GUITurretArty.java index 550de0462..128049a11 100644 --- a/src/main/java/com/hbm/inventory/gui/GUITurretArty.java +++ b/src/main/java/com/hbm/inventory/gui/GUITurretArty.java @@ -5,6 +5,7 @@ import com.hbm.packet.AuxButtonPacket; import com.hbm.packet.PacketDispatcher; import com.hbm.tileentity.turret.TileEntityTurretArty; import com.hbm.tileentity.turret.TileEntityTurretBaseNT; +import com.hbm.util.I18nUtil; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.entity.player.InventoryPlayer; @@ -17,6 +18,15 @@ public class GUITurretArty extends GUITurretBase { public GUITurretArty(InventoryPlayer invPlayer, TileEntityTurretBaseNT tedf) { super(invPlayer, tedf); } + + @Override + public void drawScreen(int mouseX, int mouseY, float f) { + super.drawScreen(mouseX, mouseY, f); + + TileEntityTurretArty arty = (TileEntityTurretArty) turret; + String mode = arty.mode == arty.MODE_ARTILLERY ? "artillery" : arty.mode == arty.MODE_CANNON ? "cannon" : "manual"; + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 151, guiTop + 16, 18, 18, mouseX, mouseY, I18nUtil.resolveKeyArray("turret.arty." + mode)); + } @Override protected void mouseClicked(int x, int y, int i) { diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 45d2ad402..239ed6bab 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -4369,7 +4369,7 @@ public class ModItems { gun_revolver_silver = new ItemGunBase(Gun44MagnumFactory.getSilverConfig()).setUnlocalizedName("gun_revolver_silver").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_revolver_silver"); gun_revolver_red = new ItemGunBase(Gun44MagnumFactory.getRedConfig()).setUnlocalizedName("gun_revolver_red").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_revolver_red"); gun_deagle = new ItemGunBase(Gun50AEFactory.getDeagleConfig()).setUnlocalizedName("gun_deagle").setFull3D().setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_deagle"); - gun_bio_revolver = new ItemGunBio(Gun50AEFactory.getDeagleConfig()).setUnlocalizedName("gun_bio_revolver").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_bio_revolver"); + gun_bio_revolver = new ItemGunBio(Gun357MagnumFactory.getRevolverBioConfig()).setUnlocalizedName("gun_bio_revolver").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_bio_revolver"); gun_flechette = new ItemGunBase(Gun556mmFactory.getSPIWConfig(), Gun556mmFactory.getGLauncherConfig()).setUnlocalizedName("gun_flechette").setFull3D().setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_flechette"); gun_ar15 = new ItemGunBase(Gun50BMGFactory.getAR15Config()).setUnlocalizedName("gun_ar15").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_ar15"); //gun_calamity_ammo = new ItemCustomLore().setUnlocalizedName("gun_calamity_ammo").setCreativeTab(null).setTextureName(RefStrings.MODID + ":gun_calamity_ammo"); diff --git a/src/main/java/com/hbm/items/weapon/ItemGunBase.java b/src/main/java/com/hbm/items/weapon/ItemGunBase.java index 15b3346bb..2c6946a9d 100644 --- a/src/main/java/com/hbm/items/weapon/ItemGunBase.java +++ b/src/main/java/com/hbm/items/weapon/ItemGunBase.java @@ -769,6 +769,10 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD { if(type == ElementType.HOTBAR) { BulletConfiguration bcfg = BulletConfigSyncingUtil.pullConfig(gun.mainConfig.config.get(ItemGunBase.getMagType(stack))); + if(bcfg == null) { + return; + } + Item ammo = bcfg.ammo; int count = ItemGunBase.getMag(stack); int max = gcfg.ammoCap; diff --git a/src/main/java/com/hbm/items/weapon/ItemGunBio.java b/src/main/java/com/hbm/items/weapon/ItemGunBio.java index c3054bca0..f2788d810 100644 --- a/src/main/java/com/hbm/items/weapon/ItemGunBio.java +++ b/src/main/java/com/hbm/items/weapon/ItemGunBio.java @@ -27,8 +27,7 @@ public class ItemGunBio extends ItemGunBase { public static List smokeNodes = new ArrayList(); @Override - public void startActionClient(ItemStack stack, World world, EntityPlayer player, boolean main) { - } + public void startActionClient(ItemStack stack, World world, EntityPlayer player, boolean main) { } @Override @SideOnly(Side.CLIENT) @@ -58,7 +57,7 @@ public class ItemGunBio extends ItemGunBase { double alpha = (System.currentTimeMillis() - ItemGunBio.lastShot) / 2000D; alpha = (1 - alpha) * 0.5D; - if(this.getReloadCycle(stack) > 0) alpha = 0; + if(this.getIsReloading(stack)) alpha = 0; smokeNodes.add(new double[] {0, 0, 0, alpha}); } diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java index c35818c77..ddc5f9124 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java @@ -91,7 +91,7 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI @Override public double getDecetorRange() { - return this.mode == this.MODE_CANNON ? 128D : 3000D; + return this.mode == this.MODE_CANNON ? 250D : 3000D; } @Override diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index db76a5c7c..040054054 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -3818,6 +3818,9 @@ tool.ability.silktouch=Behutsamkeit tool.ability.smelter=Auto-Ofen turret.animals=Passive anzielen: %s +turret.arty.artillery=Artilleriemodus$Puffer: 250m$Reichweite: 3.000m +turret.arty.cannon=Kanonenmodus$Puffer: 32m$Reichweite: 250m +turret.arty.manual=Manueller Modus$Reichweite: 3.000m turret.machines=Maschinen anzielen: %s turret.mobs=Mobs anzielen: %s turret.none=Keine diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 5d67b4dcf..fdd5061c8 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -4245,6 +4245,9 @@ tool.ability.silktouch=Silk Touch tool.ability.smelter=Auto-Smelter turret.animals=Target Passive: %s +turret.arty.artillery=§eArtillery Mode$Grace: 250m$Range: 3,000m +turret.arty.cannon=§eCannon Mode$Grace: 32m$Range: 250m +turret.arty.manual=§eManual Mode$Range: 3,000m turret.machines=Target Machines: %s turret.mobs=Target Mobs: %s turret.none=None