diff --git a/changelog b/changelog index 5e0b3f4d9..2711907d1 100644 --- a/changelog +++ b/changelog @@ -1,20 +1,3 @@ -## Added -* UAC pistol - * Uses the .45 caliber -* Cryo cannon - * Freezes entities - * Can only deal damage to already frozen entities - * Damage is proportional to max health, dealing more damage the stronger the mob is - -## Changed -* Making LPG in the compressor now requires two compression steps - * This fixes an issue where polymer is unobtainable in 528 mode since petroleum at 1PU not being obtainable -* Fire and cryo damage now bypasses glyphid's armor, being unaffected by the armor's damage reduction and not being able to break off armor either -* Fire now deals 4x more damage to glyphids -* Cryogenic fluids from the chemthrower no longer deal direct damage, instead freezing the target - * Once the target is already frozen, it will deal damage and apply the same effects as it used to - ## Fixed -* Fixed issue where mk5 explosions would behave weirdly in their origin chunk, often blowing through bedrock and thick layers of concrete -* Fixed saturnite rifle disappearing in third person when scoping -* Fixed cables not visually connecting to assemblers +* Fixed bedrock ore to cobblestone being wrong, using actual ore blocks instead of the extracted item +* Fixed missing mapping on the template chest, causing crashes diff --git a/gradle.properties b/gradle.properties index 2882b656f..aca4be12e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ mod_version=1.0.27 # Empty build number makes a release type -mod_build_number=4655 +mod_build_number=4663 credits=HbMinecraft, rodolphito (explosion algorithms), grangerave (explosion algorithms),\ \ Hoboy (textures, models), Doctor17 (russian localization), Drillgon200 (effects, models,\ diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 971f165b0..c25089dc3 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -637,11 +637,12 @@ public class ModBlocks { public static Block sat_dock; public static Block soyuz_capsule; - + public static Block crate_iron; public static Block crate_steel; public static Block crate_desh; public static Block crate_tungsten; + public static Block crate_template; public static Block safe; public static Block mass_storage; @@ -2184,6 +2185,7 @@ public class ModBlocks { crate_steel = new BlockStorageCrate(Material.iron).setBlockName("crate_steel").setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); crate_desh = new BlockStorageCrate(Material.iron).setBlockName("crate_desh").setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); crate_tungsten = new BlockStorageCrate(Material.iron).setBlockName("crate_tungsten").setStepSound(Block.soundTypeMetal).setHardness(7.5F).setResistance(300.0F).setCreativeTab(MainRegistry.machineTab); + crate_template = new BlockStorageCrate(Material.iron).setBlockName("crate_template").setStepSound(Block.soundTypeMetal).setHardness(7.5F).setResistance(300.0F).setCreativeTab(MainRegistry.machineTab); safe = new BlockStorageCrate(Material.iron).setBlockName("safe").setStepSound(Block.soundTypeMetal).setHardness(7.5F).setResistance(10000.0F).setCreativeTab(MainRegistry.machineTab); mass_storage = new BlockMassStorage().setBlockName("mass_storage").setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); @@ -3011,6 +3013,7 @@ public class ModBlocks { register(crate_steel); register(crate_desh); register(crate_tungsten); + register(crate_template); register(safe); register(mass_storage); diff --git a/src/main/java/com/hbm/blocks/generic/BlockStorageCrate.java b/src/main/java/com/hbm/blocks/generic/BlockStorageCrate.java index 4b5caa4c0..8e8f5097f 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockStorageCrate.java +++ b/src/main/java/com/hbm/blocks/generic/BlockStorageCrate.java @@ -72,6 +72,9 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti { this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":mass_storage_top"); this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":mass_storage_side"); } + if(this == ModBlocks.crate_template) { + this.iconTop = this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":crate_template"); + } } @Override @@ -90,6 +93,7 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti { if(this == ModBlocks.crate_steel) return new TileEntityCrateSteel(); if(this == ModBlocks.crate_desh) return new TileEntityCrateDesh(); if(this == ModBlocks.crate_tungsten) return new TileEntityCrateTungsten(); + if(this == ModBlocks.crate_template) return new TileEntityCrateTemplate(); if(this == ModBlocks.safe) return new TileEntitySafe(); return null; } diff --git a/src/main/java/com/hbm/blocks/machine/BlockHadronCooler.java b/src/main/java/com/hbm/blocks/machine/BlockHadronCooler.java index 95fcb17de..a242772e2 100644 --- a/src/main/java/com/hbm/blocks/machine/BlockHadronCooler.java +++ b/src/main/java/com/hbm/blocks/machine/BlockHadronCooler.java @@ -11,7 +11,6 @@ import com.hbm.util.I18nUtil; 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.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/com/hbm/config/MobConfig.java b/src/main/java/com/hbm/config/MobConfig.java index 301f330c7..8ce250f40 100644 --- a/src/main/java/com/hbm/config/MobConfig.java +++ b/src/main/java/com/hbm/config/MobConfig.java @@ -29,13 +29,14 @@ public class MobConfig { public static boolean enableMobGear = true; public static boolean enableHives = true; - public static int hiveSpawn = 128; + public static int hiveSpawn = 256; public static double scoutThreshold = 0.1; public static double tier2Threshold = 1; public static double tier3Threshold = 10; public static double tier4Threshold = 50; public static double tier5Threshold = 100; public static double spawnMax = 50; + public static double targetingThreshold = 1; public static void loadFromConfig(Configuration config) { @@ -67,12 +68,13 @@ public class MobConfig { enableMobGear = CommonConfig.createConfigBool(config, CATEGORY, "12.D01_enableMobGear", "Whether zombies and skeletons should have additional gear when spawning", true); enableHives = CommonConfig.createConfigBool(config, CATEGORY, "12.G00_enableHives", "Whether glyphid hives should spawn", true); - hiveSpawn = CommonConfig.createConfigInt(config, CATEGORY, "12.G01_hiveSpawn", "The average amount of chunks per hive", 128); + hiveSpawn = CommonConfig.createConfigInt(config, CATEGORY, "12.G01_hiveSpawn", "The average amount of chunks per hive", 256); scoutThreshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G02_scoutThreshold", "Minimum amount of soot for scouts to spawn", 0.1); tier2Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G03_tier2Threshold", "Minimum amount of soot for tier 2 glyphids to spawn", 1); tier3Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G04_tier3Threshold", "Minimum amount of soot for tier 3 glyphids to spawn", 10); tier4Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G05_tier4Threshold", "Minimum amount of soot for tier 4 glyphids to spawn", 50); tier5Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G06_tier5Threshold", "Minimum amount of soot for tier 5 glyphids to spawn", 100); spawnMax = CommonConfig.createConfigDouble(config, CATEGORY, "12.G07_spawnMax", "Maximum amount of glyphids being able to exist at once through natural spawning", 50); + targetingThreshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G08_targetingThreshold", "Minimum amount of soot required for glyphids' extended targeting range to activate", 1D); } } diff --git a/src/main/java/com/hbm/crafting/SmeltingRecipes.java b/src/main/java/com/hbm/crafting/SmeltingRecipes.java index 960689544..60a709ce0 100644 --- a/src/main/java/com/hbm/crafting/SmeltingRecipes.java +++ b/src/main/java/com/hbm/crafting/SmeltingRecipes.java @@ -183,7 +183,7 @@ public class SmeltingRecipes { for(EnumBedrockOre ore : EnumBedrockOre.values()) { int i = ore.ordinal(); - GameRegistry.addSmelting(new ItemStack(ModBlocks.ore_bedrock, 1, i), new ItemStack(Blocks.cobblestone, 16), 0.1F); + GameRegistry.addSmelting(new ItemStack(ModItems.ore_bedrock, 1, i), new ItemStack(Blocks.cobblestone, 16), 0.1F); } for(int i = 0; i < 10; i++) diff --git a/src/main/java/com/hbm/crafting/WeaponRecipes.java b/src/main/java/com/hbm/crafting/WeaponRecipes.java index a4d35d774..9218f6ee6 100644 --- a/src/main/java/com/hbm/crafting/WeaponRecipes.java +++ b/src/main/java/com/hbm/crafting/WeaponRecipes.java @@ -160,7 +160,9 @@ public class WeaponRecipes { CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_benelli), new Object[] { "HHP", "SSM", "AAP", 'H', ModItems.ingot_dura_steel, 'S', ModItems.hull_small_steel, 'A', ModItems.hull_small_aluminium, 'P', ModItems.ingot_polymer, 'M', ModItems.mechanism_rifle_2 }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_lunatic_marksman), new Object[] { " GN", "SSM", " A", 'G', KEY_ANYPANE, 'N', ModItems.powder_nitan_mix, 'S', BIGMT.plate(), 'M', ModItems.mechanism_special, 'A', ANY_RESISTANTALLOY.plateCast() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_coilgun), new Object[] { "CCC", "SSM", " P", 'C', ModBlocks.capacitor_copper, 'S', BIGMT.plate(), 'M', ModItems.mechanism_special, 'P', ANY_PLASTIC.ingot() }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_coilgun_ammo, 16), new Object[] { " T ", "TST", " T ", 'T', W.ingot(), 'S', BIGMT.ingot() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_coilgun, 16, 0), new Object[] { " T ", "TST", " T ", 'T', W.ingot(), 'S', BIGMT.ingot() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_coilgun, 16, 1), new Object[] { " T ", "TST", " T ", 'T', FERRO.ingot(), 'S', BIGMT.ingot() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_coilgun, 16, 2), new Object[] { " T ", "TST", " T ", 'T', RUBBER.ingot(), 'S', ANY_PLASTIC.ingot() }); //Ammo assemblies CraftingManager.addRecipeAuto(new ItemStack(ModItems.pellet_flechette, 1), new Object[] { " L ", " L ", "LLL", 'L', PB.nugget() }); diff --git a/src/main/java/com/hbm/entity/EntityMappings.java b/src/main/java/com/hbm/entity/EntityMappings.java index 49b065651..c9eb1c210 100644 --- a/src/main/java/com/hbm/entity/EntityMappings.java +++ b/src/main/java/com/hbm/entity/EntityMappings.java @@ -157,7 +157,6 @@ public class EntityMappings { addEntity(EntityGrenadeIFHopwire.class, "entity_grenade_ironshod_hopwire", 250); addEntity(EntityGrenadeIFNull.class, "entity_grenade_ironshod_null", 250); addEntity(EntityFallingNuke.class, "entity_falling_bomb", 1000); - addEntity(EntityBulletBase.class, "entity_bullet_mk2", 250); addEntity(EntityBulletBaseNT.class, "entity_bullet_mk3", 250, false); addEntity(EntityMinerRocket.class, "entity_miner_lander", 1000); addEntity(EntityFogFX.class, "entity_nuclear_fog", 1000); diff --git a/src/main/java/com/hbm/entity/grenade/EntityGrenadeGas.java b/src/main/java/com/hbm/entity/grenade/EntityGrenadeGas.java index 51d813653..20be9af9c 100644 --- a/src/main/java/com/hbm/entity/grenade/EntityGrenadeGas.java +++ b/src/main/java/com/hbm/entity/grenade/EntityGrenadeGas.java @@ -6,7 +6,6 @@ import net.minecraft.world.World; import java.util.Random; import com.hbm.entity.effect.EntityMist; -import com.hbm.explosion.ExplosionChaos; import com.hbm.inventory.fluid.Fluids; import com.hbm.items.ModItems; import com.hbm.items.weapon.ItemGrenade; diff --git a/src/main/java/com/hbm/entity/logic/EntityDeathBlast.java b/src/main/java/com/hbm/entity/logic/EntityDeathBlast.java index 1065b019d..c4ffd67f3 100644 --- a/src/main/java/com/hbm/entity/logic/EntityDeathBlast.java +++ b/src/main/java/com/hbm/entity/logic/EntityDeathBlast.java @@ -1,6 +1,6 @@ package com.hbm.entity.logic; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.packet.AuxParticlePacketNT; import com.hbm.packet.PacketDispatcher; @@ -45,7 +45,7 @@ public class EntityDeathBlast extends Entity { Vec3 vec = Vec3.createVectorHelper(0.2, 0, 0); vec.rotateAroundY((float)(2 * Math.PI * i / (float)count)); - EntityBulletBase laser = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.MASKMAN_BOLT); + EntityBulletBaseNT laser = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.MASKMAN_BOLT); laser.setPosition(posX, posY + 2, posZ); laser.motionX = vec.xCoord; laser.motionZ = vec.zCoord; diff --git a/src/main/java/com/hbm/entity/missile/EntityMissileCustom.java b/src/main/java/com/hbm/entity/missile/EntityMissileCustom.java index 12a2b845a..6deaa70ce 100644 --- a/src/main/java/com/hbm/entity/missile/EntityMissileCustom.java +++ b/src/main/java/com/hbm/entity/missile/EntityMissileCustom.java @@ -9,7 +9,7 @@ import com.hbm.entity.effect.EntityNukeCloudSmall; import com.hbm.entity.logic.EntityBalefire; import com.hbm.entity.logic.EntityNukeExplosionMK5; import com.hbm.entity.logic.IChunkLoader; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.explosion.ExplosionChaos; import com.hbm.explosion.ExplosionLarge; import com.hbm.handler.BulletConfigSyncingUtil; @@ -371,7 +371,7 @@ public class EntityMissileCustom extends Entity implements IChunkLoader, IRadarD Vec3 vec = Vec3.createVectorHelper(0.5, 0, 0); for(int i = 0; i < count; i++) { - EntityBulletBase blade = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.TURBINE); + EntityBulletBaseNT blade = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.TURBINE); blade.setPositionAndRotation(this.posX - this.motionX, this.posY - this.motionY + rand.nextGaussian(), this.posZ - this.motionZ, 0, 0); blade.motionX = vec.xCoord; blade.motionZ = vec.zCoord; diff --git a/src/main/java/com/hbm/entity/mob/EntityFBI.java b/src/main/java/com/hbm/entity/mob/EntityFBI.java index 827db49bd..c6426a6b3 100644 --- a/src/main/java/com/hbm/entity/mob/EntityFBI.java +++ b/src/main/java/com/hbm/entity/mob/EntityFBI.java @@ -7,7 +7,6 @@ import java.util.Set; import com.hbm.blocks.ModBlocks; import com.hbm.config.MobConfig; import com.hbm.entity.mob.ai.EntityAIBreaking; -import com.hbm.entity.mob.ai.EntityAI_MLPF; import com.hbm.entity.pathfinder.PathFinderUtils; import com.hbm.entity.projectile.EntityBullet; import com.hbm.items.ModItems; diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java index 5dcac2356..10337b458 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java @@ -4,7 +4,10 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import com.hbm.config.MobConfig; import com.hbm.entity.pathfinder.PathFinderUtils; +import com.hbm.handler.pollution.PollutionHandler; +import com.hbm.handler.pollution.PollutionHandler.PollutionType; import com.hbm.items.ModItems; import com.hbm.lib.ModDamageSource; import com.hbm.main.ResourceManager; @@ -65,7 +68,7 @@ public class EntityGlyphid extends EntityMob { @Override protected Entity findPlayerToAttack() { - EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 128.0D); + EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, useExtendedTargeting() ? 128D : 16D); return entityplayer != null && this.canEntityBeSeen(entityplayer) ? entityplayer : null; } @@ -74,10 +77,14 @@ public class EntityGlyphid extends EntityMob { super.updateEntityActionState(); // hell yeah!! - if(this.entityToAttack != null && !this.hasPath()) { + if(useExtendedTargeting() && this.entityToAttack != null && !this.hasPath()) { this.setPathToEntity(PathFinderUtils.getPathEntityToEntityPartial(worldObj, this, this.entityToAttack, 16F, true, false, false, true)); } } + + public boolean useExtendedTargeting() { + return PollutionHandler.getPollution(worldObj, (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), PollutionType.SOOT) >= MobConfig.targetingThreshold; + } @Override protected boolean canDespawn() { diff --git a/src/main/java/com/hbm/entity/mob/EntityTaintCrab.java b/src/main/java/com/hbm/entity/mob/EntityTaintCrab.java index 9c733ef12..aa0851cc9 100644 --- a/src/main/java/com/hbm/entity/mob/EntityTaintCrab.java +++ b/src/main/java/com/hbm/entity/mob/EntityTaintCrab.java @@ -3,7 +3,7 @@ package com.hbm.entity.mob; import java.util.ArrayList; import java.util.List; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.items.ModItems; import com.hbm.packet.AuxParticlePacketNT; @@ -72,7 +72,7 @@ public class EntityTaintCrab extends EntityCyberCrab { @Override public void attackEntityWithRangedAttack(EntityLivingBase entity, float f) { - EntityBulletBase bullet = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.BMG50_STAR, this); + EntityBulletBaseNT bullet = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.BMG50_STAR, this); Vec3 motion = Vec3.createVectorHelper(posX - entity.posX, posY - entity.posZ - entity.height / 2, posZ - entity.posZ); motion = motion.normalize(); NBTTagCompound data = new NBTTagCompound(); diff --git a/src/main/java/com/hbm/entity/mob/EntityUFO.java b/src/main/java/com/hbm/entity/mob/EntityUFO.java index 95e03d499..4a8f46ee5 100644 --- a/src/main/java/com/hbm/entity/mob/EntityUFO.java +++ b/src/main/java/com/hbm/entity/mob/EntityUFO.java @@ -3,7 +3,7 @@ package com.hbm.entity.mob; import java.util.ArrayList; import java.util.List; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.explosion.ExplosionNukeSmall; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.items.ModItems; @@ -326,8 +326,8 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I Vec3 heading = Vec3.createVectorHelper(e.posX - pivotX, e.posY + e.height / 2 - pivotY, e.posZ - pivotZ); heading = heading.normalize(); - EntityBulletBase bullet = new EntityBulletBase(this.worldObj, BulletConfigSyncingUtil.WORM_LASER); - bullet.shooter = this; + EntityBulletBaseNT bullet = new EntityBulletBaseNT(this.worldObj, BulletConfigSyncingUtil.WORM_LASER); + bullet.setThrower(this); bullet.setPosition(pivotX, pivotY, pivotZ); bullet.setThrowableHeading(heading.xCoord, heading.yCoord, heading.zCoord, 2F, 0.02F); this.worldObj.spawnEntityInWorld(bullet); @@ -339,8 +339,8 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I Vec3 heading = Vec3.createVectorHelper(e.posX - this.posX, e.posY + e.height / 2 - posY - 0.5D, e.posZ - this.posZ); heading = heading.normalize(); - EntityBulletBase bullet = new EntityBulletBase(this.worldObj, BulletConfigSyncingUtil.UFO_ROCKET); - bullet.shooter = this; + EntityBulletBaseNT bullet = new EntityBulletBaseNT(this.worldObj, BulletConfigSyncingUtil.UFO_ROCKET); + bullet.setThrower(this); bullet.setPosition(this.posX, this.posY - 0.5D, this.posZ); bullet.setThrowableHeading(heading.xCoord, heading.yCoord, heading.zCoord, 2F, 0.02F); bullet.getEntityData().setInteger("homingTarget", e.getEntityId()); @@ -350,7 +350,7 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I @Override public boolean canAttackClass(Class clazz) { - return clazz != this.getClass() && clazz != EntityBulletBase.class; + return clazz != this.getClass() && clazz != EntityBulletBaseNT.class; } @Override diff --git a/src/main/java/com/hbm/entity/mob/ai/EntityAIMaskmanLasergun.java b/src/main/java/com/hbm/entity/mob/ai/EntityAIMaskmanLasergun.java index a298ce331..e6abf7d7b 100644 --- a/src/main/java/com/hbm/entity/mob/ai/EntityAIMaskmanLasergun.java +++ b/src/main/java/com/hbm/entity/mob/ai/EntityAIMaskmanLasergun.java @@ -1,6 +1,6 @@ package com.hbm.entity.mob.ai; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.handler.BulletConfigSyncingUtil; import net.minecraft.entity.EntityCreature; @@ -52,7 +52,7 @@ public class EntityAIMaskmanLasergun extends EntityAIBase { switch(attack) { case ORB: - EntityBulletBase orb = new EntityBulletBase(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_ORB, owner, target, 2.0F, 0); + EntityBulletBaseNT orb = new EntityBulletBaseNT(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_ORB, owner, target, 2.0F, 0); orb.motionY += 0.5D; owner.worldObj.spawnEntityInWorld(orb); @@ -60,7 +60,7 @@ public class EntityAIMaskmanLasergun extends EntityAIBase { break; case MISSILE: - EntityBulletBase missile = new EntityBulletBase(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_ROCKET, owner, target, 1.0F, 0); + EntityBulletBaseNT missile = new EntityBulletBaseNT(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_ROCKET, owner, target, 1.0F, 0); Vec3 vec = Vec3.createVectorHelper(target.posX - owner.posX, 0, target.posZ - owner.posZ); missile.motionX = vec.xCoord * 0.05D; missile.motionY = 0.5D + owner.getRNG().nextDouble() * 0.5D; @@ -73,7 +73,7 @@ public class EntityAIMaskmanLasergun extends EntityAIBase { case SPLASH: for(int i = 0; i < 5; i++) { - EntityBulletBase tracer = new EntityBulletBase(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_TRACER, owner, target, 1.0F, 0.05F); + EntityBulletBaseNT tracer = new EntityBulletBaseNT(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_TRACER, owner, target, 1.0F, 0.05F); owner.worldObj.spawnEntityInWorld(tracer); } break; diff --git a/src/main/java/com/hbm/entity/mob/ai/EntityAIMaskmanMinigun.java b/src/main/java/com/hbm/entity/mob/ai/EntityAIMaskmanMinigun.java index e56037204..c794a1d3b 100644 --- a/src/main/java/com/hbm/entity/mob/ai/EntityAIMaskmanMinigun.java +++ b/src/main/java/com/hbm/entity/mob/ai/EntityAIMaskmanMinigun.java @@ -1,6 +1,6 @@ package com.hbm.entity.mob.ai; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.handler.BulletConfigSyncingUtil; import net.minecraft.entity.EntityCreature; @@ -49,7 +49,7 @@ public class EntityAIMaskmanMinigun extends EntityAIBase { if(timer <= 0) { timer = delay; - EntityBulletBase bullet = new EntityBulletBase(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_BULLET, owner, target, 1.0F, 0); + EntityBulletBaseNT bullet = new EntityBulletBaseNT(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_BULLET, owner, target, 1.0F, 0); owner.worldObj.spawnEntityInWorld(bullet); owner.playSound("hbm:weapon.calShoot", 1.0F, 1.0F); } diff --git a/src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeBase.java b/src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeBase.java index 1aedbd326..2ec6a830e 100644 --- a/src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeBase.java +++ b/src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeBase.java @@ -1,6 +1,6 @@ package com.hbm.entity.mob.botprime; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.handler.BulletConfigSyncingUtil; import api.hbm.entity.IRadiationImmune; @@ -80,14 +80,14 @@ public abstract class EntityBOTPrimeBase extends EntityWormBaseNT implements IRa for(int i = 0; i < 5; i++) { - EntityBulletBase bullet = new EntityBulletBase(this.worldObj, BulletConfigSyncingUtil.WORM_LASER, this, living, 1.0F, i * 0.05F); + EntityBulletBaseNT bullet = new EntityBulletBaseNT(this.worldObj, BulletConfigSyncingUtil.WORM_LASER, this, living, 1.0F, i * 0.05F); this.worldObj.spawnEntityInWorld(bullet); } this.playSound("hbm:weapon.ballsLaser", 5.0F, 0.75F); } else { - EntityBulletBase bullet = new EntityBulletBase(this.worldObj, BulletConfigSyncingUtil.WORM_BOLT, this, living, 0.5F, 0.125F); + EntityBulletBaseNT bullet = new EntityBulletBaseNT(this.worldObj, BulletConfigSyncingUtil.WORM_BOLT, this, living, 0.5F, 0.125F); this.worldObj.spawnEntityInWorld(bullet); this.playSound("hbm:weapon.ballsLaser", 5.0F, 1.0F); } diff --git a/src/main/java/com/hbm/entity/projectile/EntityBulletBase.java b/src/main/java/com/hbm/entity/projectile/EntityBulletBase.java deleted file mode 100644 index e0c8fdb92..000000000 --- a/src/main/java/com/hbm/entity/projectile/EntityBulletBase.java +++ /dev/null @@ -1,706 +0,0 @@ -package com.hbm.entity.projectile; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; - -import com.hbm.blocks.ModBlocks; -import com.hbm.blocks.generic.RedBarrel; -import com.hbm.entity.effect.EntityCloudFleijaRainbow; -import com.hbm.entity.effect.EntityEMPBlast; -import com.hbm.entity.logic.EntityNukeExplosionMK3; -import com.hbm.entity.logic.EntityNukeExplosionMK5; -import com.hbm.explosion.ExplosionChaos; -import com.hbm.explosion.ExplosionLarge; -import com.hbm.explosion.ExplosionNukeGeneric; -import com.hbm.handler.BulletConfigSyncingUtil; -import com.hbm.handler.BulletConfiguration; -import com.hbm.handler.GunConfiguration; -import com.hbm.items.weapon.ItemGunBase; -import com.hbm.main.MainRegistry; -import com.hbm.packet.AuxParticlePacketNT; -import com.hbm.packet.PacketDispatcher; -import com.hbm.potion.HbmPotion; -import com.hbm.util.ArmorUtil; -import com.hbm.util.BobMathUtil; -import com.hbm.util.Tuple.Pair; - -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; -import net.minecraft.entity.IProjectile; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.DamageSource; -import net.minecraft.util.EntityDamageSource; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; - -public class EntityBulletBase extends Entity implements IProjectile, IBulletBase { - - @Override public double prevX() { return prevRenderX; } - @Override public double prevY() { return prevRenderY; } - @Override public double prevZ() { return prevRenderZ; } - @Override public void prevX(double d) { prevRenderX = d; } - @Override public void prevY(double d) { prevRenderY = d; } - @Override public void prevZ(double d) { prevRenderZ = d; } - @Override public List> nodes() { return this.trailNodes; } - - private BulletConfiguration config; - public EntityLivingBase shooter; - public float overrideDamage; - - public double prevRenderX; - public double prevRenderY; - public double prevRenderZ; - public final List> trailNodes = new ArrayList(); - - public BulletConfiguration getConfig() { - return config; - } - - public EntityBulletBase(World world) { - super(world); - this.renderDistanceWeight = 10.0D; - this.setSize(0.5F, 0.5F); - } - - public EntityBulletBase(World world, int config) { - super(world); - this.config = BulletConfigSyncingUtil.pullConfig(config); - this.dataWatcher.updateObject(18, config); - this.renderDistanceWeight = 10.0D; - - if(this.config == null) { - this.setDead(); - return; - } - - this.dataWatcher.updateObject(16, (byte)this.config.style); - this.dataWatcher.updateObject(17, (byte)this.config.trail); - - this.setSize(0.5F, 0.5F); - } - - public EntityBulletBase(World world, int config, EntityLivingBase entity) { - super(world); - this.config = BulletConfigSyncingUtil.pullConfig(config); - this.dataWatcher.updateObject(18, config); - shooter = entity; - - ItemStack gun = entity.getHeldItem(); - boolean offsetShot = true; - - if(gun != null && gun.getItem() instanceof ItemGunBase) { - GunConfiguration cfg = ((ItemGunBase) gun.getItem()).mainConfig; - - if(cfg != null && cfg.hasSights && entity.isSneaking()) { - offsetShot = false; - } - } - - this.setLocationAndAngles(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ, entity.rotationYaw, entity.rotationPitch); - - if(offsetShot) { - double sideOffset = 0.16D; - - this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * sideOffset; - this.posY -= 0.1D; - this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * sideOffset; - } else { - this.posY -= 0.1D; - } - this.setPosition(this.posX, this.posY, this.posZ); - - this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); - this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); - this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI)); - - this.renderDistanceWeight = 10.0D; - this.setSize(0.5F, 0.5F); - - this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 1.0F, this.config.spread * (offsetShot ? 1F : 0.25F)); - - this.dataWatcher.updateObject(16, (byte)this.config.style); - this.dataWatcher.updateObject(17, (byte)this.config.trail); - } - - public EntityBulletBase(World world, int config, EntityLivingBase entity, EntityLivingBase target, float motion, float deviation) { - super(world); - - this.config = BulletConfigSyncingUtil.pullConfig(config); - this.dataWatcher.updateObject(18, config); - this.shooter = entity; - - this.renderDistanceWeight = 10.0D; - this.setSize(0.5F, 0.5F); - - this.posY = entity.posY + entity.getEyeHeight() - 0.10000000149011612D; - double d0 = target.posX - entity.posX; - double d1 = target.boundingBox.minY + target.height / 3.0F - this.posY; - double d2 = target.posZ - entity.posZ; - double d3 = MathHelper.sqrt_double(d0 * d0 + d2 * d2); - - if (d3 >= 1.0E-7D) { - float f2 = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F; - float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / Math.PI)); - double d4 = d0 / d3; - double d5 = d2 / d3; - this.setLocationAndAngles(entity.posX + d4, this.posY, entity.posZ + d5, f2, f3); - this.yOffset = 0.0F; - this.setThrowableHeading(d0, d1, d2, motion, deviation); - } - - this.dataWatcher.updateObject(16, (byte)this.config.style); - this.dataWatcher.updateObject(17, (byte)this.config.trail); - } - - public boolean attackEntityFrom(DamageSource source, float amount) { - - this.setBeenAttacked(); - - if(source instanceof EntityDamageSource) { - EntityDamageSource dmg = (EntityDamageSource) source; - - if(dmg.damageType.equals("player")) { - this.motionX *= -1.5; - this.motionY *= -1.5; - this.motionZ *= -1.5; - return true; - } - } - return false; - } - - @Override - public void setThrowableHeading(double moX, double moY, double moZ, float mult1, float mult2) { - - float f2 = MathHelper.sqrt_double(moX * moX + moY * moY + moZ * moZ); - moX /= f2; - moY /= f2; - moZ /= f2; - moX += this.rand.nextGaussian() * mult2; - moY += this.rand.nextGaussian() * mult2; - moZ += this.rand.nextGaussian() * mult2; - moX *= mult1; - moY *= mult1; - moZ *= mult1; - this.motionX = moX; - this.motionY = moY; - this.motionZ = moZ; - - float f3 = MathHelper.sqrt_double(moX * moX + moZ * moZ); - this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(moX, moZ) * 180.0D / Math.PI); - this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(moY, f3) * 180.0D / Math.PI); - } - - @Override - @SideOnly(Side.CLIENT) - public void setPositionAndRotation2(double x, double y, double z, float r0, float r1, int i) { - this.setPosition(x, y, z); - this.setRotation(r0, r1); - } - - @Override - @SideOnly(Side.CLIENT) - public void setVelocity(double x, double y, double z) { - this.motionX = x; - this.motionY = y; - this.motionZ = z; - - if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { - float f = MathHelper.sqrt_double(x * x + z * z); - this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(x, z) * 180.0D / Math.PI); - this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(y, f) * 180.0D / Math.PI); - this.prevRotationPitch = this.rotationPitch; - this.prevRotationYaw = this.rotationYaw; - this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); - } - } - - @Override - protected void entityInit() { - //style - this.dataWatcher.addObject(16, Byte.valueOf((byte) 0)); - //trail - this.dataWatcher.addObject(17, Byte.valueOf((byte) 0)); - //bullet config sync - this.dataWatcher.addObject(18, Integer.valueOf((int) 0)); - } - - @Override - public void onUpdate() { - super.onUpdate(); - - if(config == null) - config = BulletConfigSyncingUtil.pullConfig(dataWatcher.getWatchableObjectInt(18)); - - if(config == null){ - this.setDead(); - return; - } - - if(worldObj.isRemote && config.style == config.STYLE_TAU) { - if(trailNodes.isEmpty()) { - this.ignoreFrustumCheck = true; - trailNodes.add(new Pair(Vec3.createVectorHelper(-motionX * 2, -motionY * 2, -motionZ * 2), 0D)); - } else { - trailNodes.add(new Pair(Vec3.createVectorHelper(0, 0, 0), 1D)); - } - } - - if(this.config.blackPowder && this.ticksExisted == 1) { - - for(int i = 0; i < 15; i++) { - double mod = rand.nextDouble(); - this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, - (this.motionX + rand.nextGaussian() * 0.05) * mod, - (this.motionY + rand.nextGaussian() * 0.05) * mod, - (this.motionZ + rand.nextGaussian() * 0.05) * mod); - } - - double mod = 0.5; - this.worldObj.spawnParticle("flame", this.posX + this.motionX * mod, this.posY + this.motionY * mod, this.posZ + this.motionZ * mod, 0, 0, 0); - } - - if(config.maxAge == 0) { - - if(this.config.bUpdate != null) - this.config.bUpdate.behaveUpdate(this); - - this.setDead(); - return; - } - - if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { - float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI); - } - - /// ZONE 1 START /// - //entity and block collision, plinking - - /// ZONE 2 START /// - //entity detection - Vec3 vecOrigin = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - Vec3 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 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)); - - double d0 = 0.0D; - int i; - float f1; - - for (i = 0; i < list.size(); ++i) { - Entity entity1 = (Entity) list.get(i); - - if (entity1.canBeCollidedWith() && (entity1 != this.shooter)) { - f1 = 0.3F; - AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1); - MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vecOrigin, vecDestination); - - if (movingobjectposition1 != null) { - double d1 = vecOrigin.distanceTo(movingobjectposition1.hitVec); - - if (d1 < d0 || d0 == 0.0D) { - victim = entity1; - impact = movingobjectposition1; - d0 = d1; - } - } - } - } - - if (victim != null) { - movement = new MovingObjectPosition(victim); - movement.hitVec.yCoord += victim.height * 0.5D; - } - - /// ZONE 2 END /// - - boolean didBounce = false; - - if(movement != null) { - - //handle entity collision - if(movement.entityHit != null) { - - DamageSource damagesource = this.config.getDamage(this, shooter); - - if(!worldObj.isRemote) { - if(!config.doesPenetrate) { - this.setPosition(movement.hitVec.xCoord, movement.hitVec.yCoord, movement.hitVec.zCoord); - 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 && this.config.headshotMult > 1F) { - EntityLivingBase living = (EntityLivingBase) victim; - double head = living.height - living.getEyeHeight(); - - if(!!living.isEntityAlive() && impact.hitVec != null && impact.hitVec.yCoord > (living.posY + living.height - head * 2)) { - damage *= this.config.headshotMult; - headshot = true; - } - } - - if(victim != null && !victim.attackEntityFrom(damagesource, damage)) { - - try { - Field lastDamage = ReflectionHelper.findField(EntityLivingBase.class, "lastDamage", "field_110153_bc"); - - float dmg = (float) damage + lastDamage.getFloat(victim); - - 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 - } else if(worldObj.getBlock(movement.blockX, movement.blockY, movement.blockZ).getMaterial() != Material.air) { - - boolean hRic = rand.nextInt(100) < config.HBRC; - boolean doesRic = config.doesRicochet || hRic; - - if(!config.isSpectral && !doesRic) { - this.setPosition(movement.hitVec.xCoord, movement.hitVec.yCoord, movement.hitVec.zCoord); - this.onBlockImpact(movement.blockX, movement.blockY, movement.blockZ); - } - - if(doesRic) { - - Vec3 face = null; - - switch(movement.sideHit) { - case 0: - face = Vec3.createVectorHelper(0, -1, 0); break; - case 1: - face = Vec3.createVectorHelper(0, 1, 0); break; - case 2: - face = Vec3.createVectorHelper(0, 0, 1); break; - case 3: - face = Vec3.createVectorHelper(0, 0, -1); break; - case 4: - face = Vec3.createVectorHelper(-1, 0, 0); break; - case 5: - face = Vec3.createVectorHelper(1, 0, 0); break; - } - - if(face != null) { - - Vec3 vel = Vec3.createVectorHelper(motionX, motionY, motionZ); - vel.normalize(); - - boolean lRic = rand.nextInt(100) < config.LBRC; - double angle = Math.abs(BobMathUtil.getCrossAngle(vel, face) - 90); - - if(hRic || (angle <= config.ricochetAngle && lRic)) { - switch(movement.sideHit) { - case 0: - case 1: - motionY *= -1; break; - case 2: - case 3: - motionZ *= -1; break; - case 4: - case 5: - motionX *= -1; break; - } - - if(config.plink == 1) - worldObj.playSoundAtEntity(this, "hbm:weapon.ricochet", 0.25F, 1.0F); - if(config.plink == 2) - worldObj.playSoundAtEntity(this, "hbm:weapon.gBounce", 1.0F, 1.0F); - - onRicochet(movement.blockX, movement.blockY, movement.blockZ); - - } else { - if(!worldObj.isRemote) { - this.setPosition(movement.hitVec.xCoord, movement.hitVec.yCoord, movement.hitVec.zCoord); - onBlockImpact(movement.blockX, movement.blockY, movement.blockZ); - } - } - - this.posX += (movement.hitVec.xCoord - this.posX) * 0.6; - this.posY += (movement.hitVec.yCoord - this.posY) * 0.6; - this.posZ += (movement.hitVec.zCoord - this.posZ) * 0.6; - - this.motionX *= config.bounceMod; - this.motionY *= config.bounceMod; - this.motionZ *= config.bounceMod; - - didBounce = true; - } - } - } - - } - - /// ZONE 1 END /// - - if(!didBounce) { - motionY -= config.gravity; - this.posX += this.motionX * this.config.velocity; - this.posY += this.motionY * this.config.velocity; - this.posZ += this.motionZ * this.config.velocity; - this.setPosition(this.posX, this.posY, this.posZ); - } - - /// SPECIAL UPDATE BEHAVIOR /// - if(this.config.bUpdate != null) - this.config.bUpdate.behaveUpdate(this); - - float f2; - this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) - { - ; - } - - while(this.rotationPitch - this.prevRotationPitch >= 180.0F) { - this.prevRotationPitch += 360.0F; - } - - while(this.rotationYaw - this.prevRotationYaw < -180.0F) { - this.prevRotationYaw -= 360.0F; - } - - while(this.rotationYaw - this.prevRotationYaw >= 180.0F) { - this.prevRotationYaw += 360.0F; - } - - if(this.ticksExisted > config.maxAge) - this.setDead(); - - if(worldObj.isRemote && !config.vPFX.isEmpty()) { - - Vec3 vec = Vec3.createVectorHelper(posX - prevPosX, posY - prevPosY, posZ - prevPosZ); - double motion = Math.max(vec.lengthVector(), 0.1); - vec = vec.normalize(); - - for(double d = 0; d < motion; d += 0.5) { - - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setString("type", "vanillaExt"); - nbt.setString("mode", config.vPFX); - nbt.setDouble("posX", this.posX - vec.xCoord * d); - nbt.setDouble("posY", this.posY - vec.yCoord * d); - nbt.setDouble("posZ", this.posZ - vec.zCoord * d); - MainRegistry.proxy.effectNT(nbt); - } - } - - //this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; - //this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; - } - - //for when a bullet dies by hitting a block - private void onBlockImpact(int bX, int bY, int bZ) { - - if(config.bImpact != null) - config.bImpact.behaveBlockHit(this, bX, bY, bZ); - - if(!worldObj.isRemote && !config.liveAfterImpact) - this.setDead(); - - if(config.incendiary > 0 && !this.worldObj.isRemote) { - if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX, (int)posY, (int)posZ) == Blocks.air) worldObj.setBlock((int)posX, (int)posY, (int)posZ, Blocks.fire); - if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX + 1, (int)posY, (int)posZ) == Blocks.air) worldObj.setBlock((int)posX + 1, (int)posY, (int)posZ, Blocks.fire); - if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX - 1, (int)posY, (int)posZ) == Blocks.air) worldObj.setBlock((int)posX - 1, (int)posY, (int)posZ, Blocks.fire); - if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX, (int)posY + 1, (int)posZ) == Blocks.air) worldObj.setBlock((int)posX, (int)posY + 1, (int)posZ, Blocks.fire); - if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX, (int)posY - 1, (int)posZ) == Blocks.air) worldObj.setBlock((int)posX, (int)posY - 1, (int)posZ, Blocks.fire); - if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX, (int)posY, (int)posZ + 1) == Blocks.air) worldObj.setBlock((int)posX, (int)posY, (int)posZ + 1, Blocks.fire); - if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX, (int)posY, (int)posZ - 1) == Blocks.air) worldObj.setBlock((int)posX, (int)posY, (int)posZ - 1, Blocks.fire); - } - - if(config.emp > 0) - ExplosionNukeGeneric.empBlast(this.worldObj, (int)(this.posX + 0.5D), (int)(this.posY + 0.5D), (int)(this.posZ + 0.5D), config.emp); - - if(config.emp > 3) { - if (!this.worldObj.isRemote) { - - EntityEMPBlast cloud = new EntityEMPBlast(this.worldObj, config.emp); - cloud.posX = this.posX; - cloud.posY = this.posY + 0.5F; - cloud.posZ = this.posZ; - - this.worldObj.spawnEntityInWorld(cloud); - } - } - - if(config.jolt > 0 && !worldObj.isRemote) - ExplosionLarge.jolt(worldObj, posX, posY, posZ, config.jolt, 150, 0.25); - - if(config.explosive > 0 && !worldObj.isRemote) - worldObj.newExplosion(this, posX, posY, posZ, config.explosive, config.incendiary > 0, config.blockDamage); - - if(config.shrapnel > 0 && !worldObj.isRemote) - ExplosionLarge.spawnShrapnels(worldObj, posX, posY, posZ, config.shrapnel); - - if(config.chlorine > 0 && !worldObj.isRemote) { - ExplosionChaos.spawnChlorine(worldObj, posX, posY, posZ, config.chlorine, 1.5, 0); - worldObj.playSoundEffect((double)(posX + 0.5F), (double)(posY + 0.5F), (double)(posZ + 0.5F), "random.fizz", 5.0F, 2.6F + (rand.nextFloat() - rand.nextFloat()) * 0.8F); - } - - if(config.rainbow > 0 && !worldObj.isRemote) { - EntityNukeExplosionMK3 ex = EntityNukeExplosionMK3.statFacFleija(worldObj, posX, posY, posZ, config.rainbow); - if(!ex.isDead) { - this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 100.0f, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); - worldObj.spawnEntityInWorld(ex); - - EntityCloudFleijaRainbow cloud = new EntityCloudFleijaRainbow(this.worldObj, config.rainbow); - cloud.posX = this.posX; - cloud.posY = this.posY; - cloud.posZ = this.posZ; - this.worldObj.spawnEntityInWorld(cloud); - } - } - - if(config.nuke > 0 && !worldObj.isRemote) { - worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, config.nuke, posX, posY, posZ).mute()); - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", "muke"); - if(MainRegistry.polaroidID == 11 || rand.nextInt(100) == 0) data.setBoolean("balefire", true); - PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250)); - worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F); - } - - if(config.destroysBlocks && !worldObj.isRemote) { - if(worldObj.getBlock(bX, bY, bZ).getBlockHardness(worldObj, bX, bY, bZ) <= 120) - worldObj.func_147480_a(bX, bY, bZ, false); - } else if(config.doesBreakGlass && !worldObj.isRemote) { - if(worldObj.getBlock(bX, bY, bZ) == Blocks.glass || - worldObj.getBlock(bX, bY, bZ) == Blocks.glass_pane || - worldObj.getBlock(bX, bY, bZ) == Blocks.stained_glass || - worldObj.getBlock(bX, bY, bZ) == Blocks.stained_glass_pane) - worldObj.func_147480_a(bX, bY, bZ, false); - - if(worldObj.getBlock(bX, bY, bZ) == ModBlocks.red_barrel) - ((RedBarrel) ModBlocks.red_barrel).explode(worldObj, bX, bY, bZ); - } - } - - //for when a bullet dies by hitting a block - private void onRicochet(int bX, int bY, int bZ) { - - if(config.bRicochet != null) - config.bRicochet.behaveBlockRicochet(this, bX, bY, bZ); - } - - //for when a bullet dies by hitting an entity - private void onEntityImpact(Entity e) { - onEntityHurt(e); - onBlockImpact(-1, -1, -1); - - if(config.bHit != null) - config.bHit.behaveEntityHit(this, e); - } - - //for when a bullet hurts an entity, not necessarily dying - private void onEntityHurt(Entity e) { - - if(config.bHurt != null) - config.bHurt.behaveEntityHurt(this, e); - - if(config.incendiary > 0 && !worldObj.isRemote) { - e.setFire(config.incendiary); - } - - if(config.leadChance > 0 && !worldObj.isRemote && worldObj.rand.nextInt(100) < config.leadChance && e instanceof EntityLivingBase) { - ((EntityLivingBase)e).addPotionEffect(new PotionEffect(HbmPotion.lead.id, 10 * 20, 0)); - } - - if(e instanceof EntityLivingBase && config.effects != null && !config.effects.isEmpty() && !worldObj.isRemote) { - - for(PotionEffect effect : config.effects) { - ((EntityLivingBase)e).addPotionEffect(new PotionEffect(effect)); - } - } - - if(config.instakill && e instanceof EntityLivingBase && !worldObj.isRemote) { - - if(!(e instanceof EntityPlayer && ((EntityPlayer)e).capabilities.isCreativeMode)) - ((EntityLivingBase)e).setHealth(0.0F); - } - - if(config.caustic > 0 && e instanceof EntityPlayer){ - ArmorUtil.damageSuit((EntityPlayer)e, 0, config.caustic); - ArmorUtil.damageSuit((EntityPlayer)e, 1, config.caustic); - ArmorUtil.damageSuit((EntityPlayer)e, 2, config.caustic); - ArmorUtil.damageSuit((EntityPlayer)e, 3, config.caustic); - } - } - - @Override - protected void readEntityFromNBT(NBTTagCompound nbt) { - - int cfg = nbt.getInteger("config"); - this.config = BulletConfigSyncingUtil.pullConfig(cfg); - - if(this.config == null) { - this.setDead(); - return; - } - - this.overrideDamage = nbt.getFloat("damage"); - - this.dataWatcher.updateObject(18, cfg); - - this.dataWatcher.updateObject(16, (byte)this.config.style); - this.dataWatcher.updateObject(17, (byte)this.config.trail); - } - - @Override - protected void writeEntityToNBT(NBTTagCompound nbt) { - - nbt.setInteger("config", dataWatcher.getWatchableObjectInt(18)); - - nbt.setFloat("damage", this.overrideDamage); - } - -} diff --git a/src/main/java/com/hbm/entity/projectile/EntityBulletBaseNT.java b/src/main/java/com/hbm/entity/projectile/EntityBulletBaseNT.java index a3ce55d10..65741dbd4 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityBulletBaseNT.java +++ b/src/main/java/com/hbm/entity/projectile/EntityBulletBaseNT.java @@ -132,7 +132,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet this.renderDistanceWeight = 10.0D; this.setSize(0.5F, 0.5F); - System.out.println("" + this.config.spread); this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 1.0F, this.config.spread * (offsetShot ? 1F : 0.25F)); } @@ -211,12 +210,12 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet if(!worldObj.isRemote) { if(config.maxAge == 0) { - if(this.config.bUpdate != null) this.config.bntUpdate.behaveUpdate(this); + if(this.config.bntUpdate != null) this.config.bntUpdate.behaveUpdate(this); this.setDead(); return; } - if(this.config.bUpdate != null) this.config.bntUpdate.behaveUpdate(this); + if(this.config.bntUpdate != null) this.config.bntUpdate.behaveUpdate(this); if(this.ticksExisted > config.maxAge) this.setDead(); } @@ -295,7 +294,10 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet if(config.plink == 2) worldObj.playSoundAtEntity(this, "hbm:weapon.gBounce", 1.0F, 1.0F); + this.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord); onRicochet(mop.blockX, mop.blockY, mop.blockZ); + + //worldObj.setBlock((int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), Blocks.dirt); } else { if(!worldObj.isRemote) { @@ -304,10 +306,10 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet } } - this.posX += (mop.hitVec.xCoord - this.posX) * 0.6; + /*this.posX += (mop.hitVec.xCoord - this.posX) * 0.6; this.posY += (mop.hitVec.yCoord - this.posY) * 0.6; - this.posZ += (mop.hitVec.zCoord - this.posZ) * 0.6; - + this.posZ += (mop.hitVec.zCoord - this.posZ) * 0.6;*/ + this.motionX *= config.bounceMod; this.motionY *= config.bounceMod; this.motionZ *= config.bounceMod; @@ -378,8 +380,10 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet if(config.bntImpact != null) config.bntImpact.behaveBlockHit(this, bX, bY, bZ); - if(!worldObj.isRemote && !config.liveAfterImpact) - this.setDead(); + if(!worldObj.isRemote) { + if(!config.liveAfterImpact && !config.isSpectral && bY > -1) this.setDead(); + if(!config.doesPenetrate && bY == -1) this.setDead(); + } if(config.incendiary > 0 && !this.worldObj.isRemote) { if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX, (int)posY, (int)posZ) == Blocks.air) worldObj.setBlock((int)posX, (int)posY, (int)posZ, Blocks.fire); @@ -472,6 +476,8 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet if(config.bntHit != null) config.bntHit.behaveEntityHit(this, e); + + //this.setDead(); } //for when a bullet hurts an entity, not necessarily dying @@ -519,6 +525,11 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet return this.config.isSpectral; } + @Override + public int selfDamageDelay() { + return this.config.selfDamageDelay; + } + @Override protected double headingForceMult() { return 1D; @@ -568,9 +579,9 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet nbt.setFloat("damage", this.overrideDamage); } - public interface IBulletHurtBehaviorNT { public void behaveEntityHurt(EntityBulletBaseNT bullet, Entity hit); } - public interface IBulletHitBehaviorNT { public void behaveEntityHit(EntityBulletBaseNT bullet, Entity hit); } - public interface IBulletRicochetBehaviorNT { public void behaveBlockRicochet(EntityBulletBaseNT bullet, int x, int y, int z); } - public interface IBulletImpactBehaviorNT { public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z); } - public interface IBulletUpdateBehaviorNT { public void behaveUpdate(EntityBulletBaseNT bullet); } + public static interface IBulletHurtBehaviorNT { public void behaveEntityHurt(EntityBulletBaseNT bullet, Entity hit); } + public static interface IBulletHitBehaviorNT { public void behaveEntityHit(EntityBulletBaseNT bullet, Entity hit); } + public static interface IBulletRicochetBehaviorNT { public void behaveBlockRicochet(EntityBulletBaseNT bullet, int x, int y, int z); } + public static interface IBulletImpactBehaviorNT { public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z); } + public static interface IBulletUpdateBehaviorNT { public void behaveUpdate(EntityBulletBaseNT bullet); } } diff --git a/src/main/java/com/hbm/entity/projectile/EntityChemical.java b/src/main/java/com/hbm/entity/projectile/EntityChemical.java index d64e64d74..3eb72cddc 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityChemical.java +++ b/src/main/java/com/hbm/entity/projectile/EntityChemical.java @@ -175,7 +175,7 @@ public class EntityChemical extends EntityThrowableNT { } if(type.temperature >= 100) { - EntityDamageUtil.attackEntityFromIgnoreIFrame(e, getDamage(ModDamageSource.s_boil), 5F + (type.temperature - 100) * 0.02F); //5 damage at 100°C with one extra damage every 50°C + EntityDamageUtil.attackEntityFromIgnoreIFrame(e, getDamage(ModDamageSource.s_boil), 0.25F + (type.temperature - 100) * 0.001F); //.25 damage at 100°C with one extra damage every 1000°C if(type.temperature >= 500) { e.setFire(10); //afterburn for 10 seconds @@ -235,11 +235,11 @@ public class EntityChemical extends EntityThrowableNT { if(type.hasTrait(FT_Corrosive.class)) { FT_Corrosive trait = type.getTrait(FT_Corrosive.class); - EntityDamageUtil.attackEntityFromIgnoreIFrame(e, getDamage(ModDamageSource.s_acid), trait.getRating() / 20F); + EntityDamageUtil.attackEntityFromIgnoreIFrame(e, getDamage(ModDamageSource.s_acid), trait.getRating() / 50F); if(living != null) { for(int i = 0; i < 4; i++) { - ArmorUtil.damageSuit(living, i, trait.getRating() / 5); + ArmorUtil.damageSuit(living, i, (int) Math.ceil(trait.getRating() / 50)); } } } diff --git a/src/main/java/com/hbm/entity/projectile/EntityCombineBallNT.java b/src/main/java/com/hbm/entity/projectile/EntityCombineBallNT.java index 1c0b0f27c..e9c5dc228 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityCombineBallNT.java +++ b/src/main/java/com/hbm/entity/projectile/EntityCombineBallNT.java @@ -3,7 +3,7 @@ package com.hbm.entity.projectile; import net.minecraft.entity.EntityLivingBase; import net.minecraft.world.World; -public class EntityCombineBallNT extends EntityBulletBase { +public class EntityCombineBallNT extends EntityBulletBaseNT { public EntityCombineBallNT(World world, int config, EntityLivingBase shooter) { super(world, config, shooter); @@ -13,6 +13,6 @@ public class EntityCombineBallNT extends EntityBulletBase { @Override public void setDead() { super.setDead(); - worldObj.createExplosion(shooter, posX, posY, posZ, 2, false); + worldObj.createExplosion(this.getThrower(), posX, posY, posZ, 2, false); } } diff --git a/src/main/java/com/hbm/entity/projectile/EntityThrowableNT.java b/src/main/java/com/hbm/entity/projectile/EntityThrowableNT.java index ca5a551b2..ebde86c60 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityThrowableNT.java +++ b/src/main/java/com/hbm/entity/projectile/EntityThrowableNT.java @@ -172,7 +172,7 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile { if(mop != null) { nextPos = Vec3.createVectorHelper(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord); } - + if(!this.worldObj.isRemote) { Entity hitEntity = null; @@ -182,8 +182,8 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile { for(int j = 0; j < list.size(); ++j) { Entity entity = (Entity) list.get(j); - - if(entity.canBeCollidedWith() && (entity != thrower || this.ticksInAir >= 5)) { + + if(entity.canBeCollidedWith() && (entity != thrower || this.ticksInAir >= this.selfDamageDelay())) { double hitbox = 0.3F; AxisAlignedBB aabb = entity.boundingBox.expand(hitbox, hitbox, hitbox); MovingObjectPosition hitMop = aabb.calculateIntercept(pos, nextPos); @@ -192,7 +192,7 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile { // if penetration is enabled, run impact for all intersecting entities if(this.doesPenetrate()) { - this.onImpact(hitMop); + this.onImpact(new MovingObjectPosition(entity)); } else { double dist = pos.distanceTo(hitMop.hitVec); @@ -212,6 +212,10 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile { } } + this.posX += this.motionX * motionMult(); + this.posY += this.motionY * motionMult(); + this.posZ += this.motionZ * motionMult(); + if(mop != null) { if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ) == Blocks.portal) { this.setInPortal(); @@ -219,10 +223,6 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile { this.onImpact(mop); } } - - this.posX += this.motionX * motionMult(); - this.posY += this.motionY * motionMult(); - this.posZ += this.motionZ * motionMult(); float hyp = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); @@ -274,6 +274,10 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile { return false; } + public int selfDamageDelay() { + return 5; + } + public void getStuck(int x, int y, int z) { this.stuckBlockX = x; this.stuckBlockY = y; @@ -327,6 +331,10 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile { public float getShadowSize() { return 0.0F; } + + public void setThrower(EntityLivingBase thrower) { + this.thrower = thrower; + } public EntityLivingBase getThrower() { if(this.thrower == null && this.throwerName != null && this.throwerName.length() > 0) { diff --git a/src/main/java/com/hbm/explosion/ExplosionNukeGeneric.java b/src/main/java/com/hbm/explosion/ExplosionNukeGeneric.java index c8c15c8a9..c2a58d0a1 100644 --- a/src/main/java/com/hbm/explosion/ExplosionNukeGeneric.java +++ b/src/main/java/com/hbm/explosion/ExplosionNukeGeneric.java @@ -24,7 +24,7 @@ import com.hbm.entity.effect.EntityNukeCloudSmall; import com.hbm.entity.grenade.EntityGrenadeASchrab; import com.hbm.entity.grenade.EntityGrenadeNuclear; import com.hbm.entity.missile.EntityMIRV; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.entity.projectile.EntityExplosiveBeam; import com.hbm.interfaces.Spaghetti; import com.hbm.items.ModItems; @@ -108,7 +108,7 @@ public class ExplosionNukeGeneric { e instanceof EntityGrenadeASchrab || e instanceof EntityGrenadeNuclear || e instanceof EntityExplosiveBeam || - e instanceof EntityBulletBase || + e instanceof EntityBulletBaseNT || e instanceof EntityPlayer && ArmorUtil.checkArmor((EntityPlayer) e, ModItems.euphemium_helmet, ModItems.euphemium_plate, ModItems.euphemium_legs, ModItems.euphemium_boots)) { return true; diff --git a/src/main/java/com/hbm/handler/BulletConfigSyncingUtil.java b/src/main/java/com/hbm/handler/BulletConfigSyncingUtil.java index c37a03eed..19987ab65 100644 --- a/src/main/java/com/hbm/handler/BulletConfigSyncingUtil.java +++ b/src/main/java/com/hbm/handler/BulletConfigSyncingUtil.java @@ -159,7 +159,10 @@ public class BulletConfigSyncingUtil { public static int SPECIAL_GAUSS = i++; public static int SPECIAL_GAUSS_CHARGED = i++; public static int SPECIAL_EMP = i++; - public static int SPECIAL_COIL = i++; + + public static int COIL_NORMAL = i++; + public static int COIL_DU = i++; + public static int COIL_RUBBER = i++; public static int FLAMER_NORMAL = i++; public static int FLAMER_NAPALM = i++; @@ -452,7 +455,10 @@ public class BulletConfigSyncingUtil { configSet.put(SPECIAL_GAUSS, GunGaussFactory.getGaussConfig()); configSet.put(SPECIAL_GAUSS_CHARGED, GunGaussFactory.getAltConfig()); configSet.put(SPECIAL_EMP, GunEnergyFactory.getOrbusConfig()); - configSet.put(SPECIAL_COIL, GunEnergyFactory.getCoilConfig()); + + configSet.put(COIL_NORMAL, GunEnergyFactory.getCoilConfig()); + configSet.put(COIL_DU, GunEnergyFactory.getCoilDUConfig()); + configSet.put(COIL_RUBBER, GunEnergyFactory.getCoilRubberConfig()); configSet.put(FLAMER_NORMAL, GunEnergyFactory.getFlameConfig()); configSet.put(FLAMER_NAPALM, GunEnergyFactory.getNapalmConfig()); diff --git a/src/main/java/com/hbm/handler/BulletConfiguration.java b/src/main/java/com/hbm/handler/BulletConfiguration.java index fe3745bc5..1a5c07498 100644 --- a/src/main/java/com/hbm/handler/BulletConfiguration.java +++ b/src/main/java/com/hbm/handler/BulletConfiguration.java @@ -2,15 +2,9 @@ package com.hbm.handler; import java.util.List; -import com.hbm.entity.projectile.EntityBulletBase; import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.entity.projectile.EntityBulletBaseNT.*; import com.hbm.handler.guncfg.BulletConfigFactory; -import com.hbm.interfaces.IBulletHitBehavior; -import com.hbm.interfaces.IBulletHurtBehavior; -import com.hbm.interfaces.IBulletImpactBehavior; -import com.hbm.interfaces.IBulletRicochetBehavior; -import com.hbm.interfaces.IBulletUpdateBehavior; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.lib.ModDamageSource; import com.hbm.main.MainRegistry; @@ -60,14 +54,16 @@ public class BulletConfiguration implements Cloneable { public int HBRC; //how much of the initial velocity is kept after bouncing public double bounceMod; + //how many ticks until the projectile can hurt the shooter + public int selfDamageDelay = 5; //whether or not the bullet should penetrate mobs public boolean doesPenetrate; - //whether or not the bullet should phase through blocks + //disables collisions with blocks entirely public boolean isSpectral; //whether or not the bullet should break glass public boolean doesBreakGlass; - //whether the bullet should stay alive after colliding with a block + //bullets still call the impact function when hitting blocks but do not get destroyed public boolean liveAfterImpact; //creates a "muzzle flash" and a ton of smoke with every projectile spawned @@ -88,11 +84,11 @@ public class BulletConfiguration implements Cloneable { public int caustic; public boolean destroysBlocks; public boolean instakill; - public IBulletHurtBehavior bHurt; + /*public IBulletHurtBehavior bHurt; public IBulletHitBehavior bHit; public IBulletRicochetBehavior bRicochet; public IBulletImpactBehavior bImpact; - public IBulletUpdateBehavior bUpdate; + public IBulletUpdateBehavior bUpdate;*/ public IBulletHurtBehaviorNT bntHurt; public IBulletHitBehaviorNT bntHit; public IBulletRicochetBehaviorNT bntRicochet; @@ -179,13 +175,13 @@ public class BulletConfiguration implements Cloneable { public BulletConfiguration setToGuided() { - this.bUpdate = BulletConfigFactory.getLaserSteering(); + this.bntUpdate = BulletConfigFactory.getLaserSteering(); this.doesRicochet = false; return this; } public BulletConfiguration getChlorophyte() { - this.bUpdate = BulletConfigFactory.getHomingBehavior(200, 45); + this.bntUpdate = BulletConfigFactory.getHomingBehavior(200, 45); this.dmgMin *= 1.5F; this.dmgMax *= 1.5F; this.wear *= 0.5; @@ -219,28 +215,6 @@ public class BulletConfiguration implements Cloneable { return this; } - public DamageSource getDamage(EntityBulletBase bullet, EntityLivingBase shooter) { - - DamageSource dmg; - - String unloc = damageType; - - if(unloc.equals(ModDamageSource.s_zomg_prefix)) - unloc += (bullet.worldObj.rand.nextInt(5) + 1); //pain - - if(shooter != null) - dmg = new EntityDamageSourceIndirect(unloc, bullet, shooter); - else - dmg = new DamageSource(unloc); - - if(this.dmgProj) dmg.setProjectile(); - if(this.dmgFire) dmg.setFireDamage(); - if(this.dmgExplosion) dmg.setExplosion(); - if(this.dmgBypass) dmg.setDamageBypassesArmor(); - - return dmg; - } - public DamageSource getDamage(EntityBulletBaseNT bullet, EntityLivingBase shooter) { DamageSource dmg; diff --git a/src/main/java/com/hbm/handler/guncfg/BulletConfigFactory.java b/src/main/java/com/hbm/handler/guncfg/BulletConfigFactory.java index c8e3bebd0..01549a613 100644 --- a/src/main/java/com/hbm/handler/guncfg/BulletConfigFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/BulletConfigFactory.java @@ -4,13 +4,12 @@ import java.util.List; import java.util.Random; import com.hbm.entity.particle.EntityBSmokeFX; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; +import com.hbm.entity.projectile.EntityBulletBaseNT.*; import com.hbm.explosion.ExplosionNukeSmall; import com.hbm.explosion.ExplosionNukeSmall.MukeParams; 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.ItemAmmoEnums.*; import com.hbm.items.ModItems; @@ -144,10 +143,10 @@ public class BulletConfigFactory { bullet.leadChance = 0; bullet.vPFX = "reddust"; - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { if(bullet.worldObj.isRemote) return; @@ -164,9 +163,10 @@ public class BulletConfigFactory { Vec3 motion = Vec3.createVectorHelper(bullet.posX - dx, bullet.posY - dy, bullet.posZ - dz); motion = motion.normalize(); - EntityBulletBase bolt = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.R556_FLECHETTE_DU); + EntityBulletBaseNT bolt = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.R556_FLECHETTE_DU); bolt.setPosition(dx, dy, dz); bolt.setThrowableHeading(motion.xCoord, motion.yCoord, motion.zCoord, 0.5F, 0.1F); + bolt.setThrower(bullet.getThrower()); bullet.worldObj.spawnEntityInWorld(bolt); if(i < 30) { @@ -310,12 +310,12 @@ public class BulletConfigFactory { } } - public static IBulletImpactBehavior getPhosphorousEffect(final int radius, final int duration, final int count, final double motion, float hazeChance) { + public static IBulletImpactBehaviorNT getPhosphorousEffect(final int radius, final int duration, final int count, final double motion, float hazeChance) { - IBulletImpactBehavior impact = new IBulletImpactBehavior() { + IBulletImpactBehaviorNT impact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { List hit = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet, AxisAlignedBB.getBoundingBox(bullet.posX - radius, bullet.posY - radius, bullet.posZ - radius, bullet.posX + radius, bullet.posY + radius, bullet.posZ + radius)); @@ -352,12 +352,12 @@ public class BulletConfigFactory { return impact; } - public static IBulletImpactBehavior getGasEffect(final int radius, final int duration) { + public static IBulletImpactBehaviorNT getGasEffect(final int radius, final int duration) { - IBulletImpactBehavior impact = new IBulletImpactBehavior() { + IBulletImpactBehaviorNT impact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { List hit = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet, AxisAlignedBB.getBoundingBox(bullet.posX - radius, bullet.posY - radius, bullet.posZ - radius, bullet.posX + radius, bullet.posY + radius, bullet.posZ + radius)); @@ -401,20 +401,20 @@ public class BulletConfigFactory { return impact; } - public static IBulletUpdateBehavior getLaserSteering() { + public static IBulletUpdateBehaviorNT getLaserSteering() { - IBulletUpdateBehavior onUpdate = new IBulletUpdateBehavior() { + IBulletUpdateBehaviorNT onUpdate = new IBulletUpdateBehaviorNT() { @Override - public void behaveUpdate(EntityBulletBase bullet) { + public void behaveUpdate(EntityBulletBaseNT bullet) { - if(bullet.shooter == null || !(bullet.shooter instanceof EntityPlayer)) + if(bullet.getThrower() == null || !(bullet.getThrower() instanceof EntityPlayer)) return; - if(Vec3.createVectorHelper(bullet.posX - bullet.shooter.posX, bullet.posY - bullet.shooter.posY, bullet.posZ - bullet.shooter.posZ).lengthVector() > 100) + if(Vec3.createVectorHelper(bullet.posX - bullet.getThrower().posX, bullet.posY - bullet.getThrower().posY, bullet.posZ - bullet.getThrower().posZ).lengthVector() > 100) return; - MovingObjectPosition mop = Library.rayTrace((EntityPlayer)bullet.shooter, 200, 1); + MovingObjectPosition mop = Library.rayTrace((EntityPlayer)bullet.getThrower(), 200, 1); if(mop == null || mop.hitVec == null) return; @@ -438,12 +438,12 @@ public class BulletConfigFactory { return onUpdate; } - public static IBulletUpdateBehavior getHomingBehavior(final double range, final double angle) { + public static IBulletUpdateBehaviorNT getHomingBehavior(final double range, final double angle) { - IBulletUpdateBehavior onUpdate = new IBulletUpdateBehavior() { + IBulletUpdateBehaviorNT onUpdate = new IBulletUpdateBehaviorNT() { @Override - public void behaveUpdate(EntityBulletBase bullet) { + public void behaveUpdate(EntityBulletBaseNT bullet) { if(bullet.worldObj.isRemote) return; @@ -467,7 +467,7 @@ public class BulletConfigFactory { } } - private void chooseTarget(EntityBulletBase bullet) { + private void chooseTarget(EntityBulletBaseNT bullet) { List entities = bullet.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bullet.boundingBox.expand(range, range, range)); @@ -478,7 +478,7 @@ public class BulletConfigFactory { for(EntityLivingBase e : entities) { - if(!e.isEntityAlive() || e == bullet.shooter) + if(!e.isEntityAlive() || e == bullet.getThrower()) continue; Vec3 delta = Vec3.createVectorHelper(e.posX - bullet.posX, e.posY + e.height / 2 - bullet.posY, e.posZ - bullet.posZ); diff --git a/src/main/java/com/hbm/handler/guncfg/Gun12GaugeFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun12GaugeFactory.java index 0a397f04a..424deacfc 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun12GaugeFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun12GaugeFactory.java @@ -2,12 +2,9 @@ package com.hbm.handler.guncfg; import java.util.List; -import com.hbm.entity.projectile.EntityBulletBase; import com.hbm.handler.BulletConfiguration; import com.hbm.handler.CasingEjector; import com.hbm.handler.GunConfiguration; -import com.hbm.interfaces.IBulletHurtBehavior; -import com.hbm.interfaces.IBulletUpdateBehavior; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.items.ItemAmmoEnums.Ammo12Gauge; import com.hbm.items.ModItems; @@ -372,14 +369,10 @@ public class Gun12GaugeFactory { bullet.dmgMax = 500; bullet.leadChance = 50; - bullet.bHurt = new IBulletHurtBehavior() { - - @Override - public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) { + bullet.bntHurt = (bulletnt, hit) -> { - if(hit instanceof EntityLivingBase) - ((EntityLivingBase)hit).addPotionEffect(new PotionEffect(HbmPotion.bang.id, 20, 0)); - } + if(hit instanceof EntityLivingBase) + ((EntityLivingBase)hit).addPotionEffect(new PotionEffect(HbmPotion.bang.id, 20, 0)); }; @@ -413,38 +406,34 @@ public class Gun12GaugeFactory { bullet.spentCasing = CASING12GAUGE.clone().register("12GaPerc").setColor(0x9E1616, SpentCasing.COLOR_CASE_12GA).setupSmoke(1F, 0.5D, 60, 40); - bullet.bUpdate = new IBulletUpdateBehavior() { - - @Override - public void behaveUpdate(EntityBulletBase bullet) { + bullet.bntUpdate = (bulletnt) -> { + + if(!bulletnt.worldObj.isRemote) { + + Vec3 vec = Vec3.createVectorHelper(bulletnt.motionX, bulletnt.motionY, bulletnt.motionZ); + double radius = 4; + double x = bulletnt.posX + vec.xCoord; + double y = bulletnt.posY + vec.yCoord; + double z = bulletnt.posZ + vec.zCoord; + AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(x, y, z, x, y, z).expand(radius, radius, radius); + List list = bulletnt.worldObj.getEntitiesWithinAABBExcludingEntity(bulletnt.getThrower(), aabb); - if(!bullet.worldObj.isRemote) { - - Vec3 vec = Vec3.createVectorHelper(bullet.motionX, bullet.motionY, bullet.motionZ); - double radius = 4; - double x = bullet.posX + vec.xCoord; - double y = bullet.posY + vec.yCoord; - double z = bullet.posZ + vec.zCoord; - AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(x, y, z, x, y, z).expand(radius, radius, radius); - List list = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet.shooter, aabb); - - for(Entity e : list) { - DamageSource source = bullet.shooter instanceof EntityPlayer ? DamageSource.causePlayerDamage((EntityPlayer) bullet.shooter) : DamageSource.magic; - e.attackEntityFrom(source, 30F); - } - - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", "plasmablast"); - data.setFloat("r", 0.75F); - data.setFloat("g", 0.75F); - data.setFloat("b", 0.75F); - data.setFloat("pitch", (float) -bullet.rotationPitch + 90); - data.setFloat("yaw", (float) bullet.rotationYaw); - data.setFloat("scale", 2F); - PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(bullet.dimension, x, y, z, 100)); - - bullet.setDead(); + for(Entity e : list) { + DamageSource source = bulletnt.getThrower() instanceof EntityPlayer ? DamageSource.causePlayerDamage((EntityPlayer) bulletnt.getThrower()) : DamageSource.magic; + e.attackEntityFrom(source, 30F); } + + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "plasmablast"); + data.setFloat("r", 0.75F); + data.setFloat("g", 0.75F); + data.setFloat("b", 0.75F); + data.setFloat("pitch", (float) -bulletnt.rotationPitch + 90); + data.setFloat("yaw", (float) bulletnt.rotationYaw); + data.setFloat("scale", 2F); + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(bulletnt.dimension, x, y, z, 100)); + + bulletnt.setDead(); } }; diff --git a/src/main/java/com/hbm/handler/guncfg/Gun44MagnumFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun44MagnumFactory.java index 05ad9902a..a0dff1be2 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun44MagnumFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun44MagnumFactory.java @@ -5,14 +5,11 @@ import java.util.ArrayList; import com.hbm.entity.particle.EntityBSmokeFX; import com.hbm.entity.projectile.EntityBoxcar; import com.hbm.entity.projectile.EntityBuilding; -import com.hbm.entity.projectile.EntityBulletBase; import com.hbm.entity.projectile.EntityDuchessGambit; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; import com.hbm.handler.CasingEjector; import com.hbm.handler.GunConfiguration; -import com.hbm.interfaces.IBulletHitBehavior; -import com.hbm.interfaces.IBulletImpactBehavior; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.items.ModItems; import com.hbm.items.ItemAmmoEnums.Ammo44Magnum; @@ -27,7 +24,6 @@ import com.hbm.potion.HbmPotion; import com.hbm.render.util.RenderScreenOverlay.Crosshair; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ResourceLocation; @@ -227,19 +223,15 @@ public class Gun44MagnumFactory { bullet.effects = new ArrayList(); bullet.effects.add(new PotionEffect(eff)); - bullet.bImpact = new IBulletImpactBehavior() { - - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", "vanillaburst"); - data.setString("mode", "flame"); - data.setInteger("count", 15); - data.setDouble("motion", 0.05D); - - PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50)); - } + bullet.bntImpact = (bulletnt, x, y, z) -> { + + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "vanillaburst"); + data.setString("mode", "flame"); + data.setInteger("count", 15); + data.setDouble("motion", 0.05D); + + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ), new TargetPoint(bulletnt.dimension, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 50)); }; bullet.spentCasing = CASING44.clone().register("44Phos"); @@ -272,27 +264,21 @@ public class Gun44MagnumFactory { bullet.wear = 25; bullet.doesPenetrate = false; - bullet.bHit = new IBulletHitBehavior() { - - @Override - public void behaveEntityHit(EntityBulletBase bullet, Entity hit) { + bullet.bntHit = (bulletnt, hit) -> { - if(!bullet.worldObj.isRemote) { - EntityBoxcar pippo = new EntityBoxcar(bullet.worldObj); - pippo.posX = hit.posX; - pippo.posY = hit.posY + 50; - pippo.posZ = hit.posZ; - - for(int j = 0; j < 50; j++) { - EntityBSmokeFX fx = new EntityBSmokeFX(bullet.worldObj, pippo.posX + (bullet.worldObj.rand.nextDouble() - 0.5) * 4, pippo.posY + (bullet.worldObj.rand.nextDouble() - 0.5) * 12, pippo.posZ + (bullet.worldObj.rand.nextDouble() - 0.5) * 4, 0, 0, 0); - bullet.worldObj.spawnEntityInWorld(fx); - } - bullet.worldObj.spawnEntityInWorld(pippo); - - bullet.worldObj.playSoundEffect(pippo.posX, - pippo.posY + 50, - pippo.posZ, "hbm:alarm.trainHorn", 100F, 1F); + if(!bulletnt.worldObj.isRemote) { + EntityBoxcar pippo = new EntityBoxcar(bulletnt.worldObj); + pippo.posX = hit.posX; + pippo.posY = hit.posY + 50; + pippo.posZ = hit.posZ; + + for(int j = 0; j < 50; j++) { + EntityBSmokeFX fx = new EntityBSmokeFX(bulletnt.worldObj, pippo.posX + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 4, pippo.posY + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 12, pippo.posZ + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 4, 0, 0, 0); + bulletnt.worldObj.spawnEntityInWorld(fx); } + bulletnt.worldObj.spawnEntityInWorld(pippo); + + bulletnt.worldObj.playSoundEffect(pippo.posX, pippo.posY + 50, pippo.posZ, "hbm:alarm.trainHorn", 100F, 1F); } }; @@ -311,29 +297,22 @@ public class Gun44MagnumFactory { bullet.wear = 25; bullet.doesPenetrate = false; - bullet.bHit = new IBulletHitBehavior() { - - @Override - public void behaveEntityHit(EntityBulletBase bullet, Entity hit) { + bullet.bntHit = (bulletnt, hit) -> { - if(!bullet.worldObj.isRemote) { - EntityDuchessGambit pippo = new EntityDuchessGambit(bullet.worldObj); - pippo.posX = hit.posX; - pippo.posY = hit.posY + 50; - pippo.posZ = hit.posZ; - - for(int j = 0; j < 150; j++) { - EntityBSmokeFX fx = new EntityBSmokeFX(bullet.worldObj, pippo.posX + (bullet.worldObj.rand.nextDouble() - 0.5) * 7, pippo.posY + (bullet.worldObj.rand.nextDouble() - 0.5) * 8, pippo.posZ + (bullet.worldObj.rand.nextDouble() - 0.5) * 18, 0, 0, 0); - bullet.worldObj.spawnEntityInWorld(fx); - } - bullet.worldObj.spawnEntityInWorld(pippo); - - bullet.worldObj.playSoundEffect(pippo.posX, - pippo.posY + 50, - pippo.posZ, "hbm:weapon.boat", 100F, 1F); + if(!bulletnt.worldObj.isRemote) { + EntityDuchessGambit pippo = new EntityDuchessGambit(bulletnt.worldObj); + pippo.posX = hit.posX; + pippo.posY = hit.posY + 50; + pippo.posZ = hit.posZ; + + for(int j = 0; j < 150; j++) { + EntityBSmokeFX fx = new EntityBSmokeFX(bulletnt.worldObj, pippo.posX + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 7, pippo.posY + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 8, pippo.posZ + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 18, 0, 0, 0); + bulletnt.worldObj.spawnEntityInWorld(fx); } + bulletnt.worldObj.spawnEntityInWorld(pippo); + + bulletnt.worldObj.playSoundEffect(pippo.posX, pippo.posY + 50, pippo.posZ, "hbm:weapon.boat", 100F, 1F); } - }; bullet.spentCasing = CASING44.clone().register("44BJ").setColor(0x632B2C); @@ -351,29 +330,22 @@ public class Gun44MagnumFactory { bullet.wear = 25; bullet.doesPenetrate = false; - bullet.bHit = new IBulletHitBehavior() { - - @Override - public void behaveEntityHit(EntityBulletBase bullet, Entity hit) { + bullet.bntHit = (bulletnt, hit) -> { - if(!bullet.worldObj.isRemote) { - EntityBuilding pippo = new EntityBuilding(bullet.worldObj); - pippo.posX = hit.posX; - pippo.posY = hit.posY + 50; - pippo.posZ = hit.posZ; - - for(int j = 0; j < 150; j++) { - EntityBSmokeFX fx = new EntityBSmokeFX(bullet.worldObj, pippo.posX + (bullet.worldObj.rand.nextDouble() - 0.5) * 15, pippo.posY + (bullet.worldObj.rand.nextDouble() - 0.5) * 15, pippo.posZ + (bullet.worldObj.rand.nextDouble() - 0.5) * 15, 0, 0, 0); - bullet.worldObj.spawnEntityInWorld(fx); - } - bullet.worldObj.spawnEntityInWorld(pippo); - - bullet.worldObj.playSoundEffect(pippo.posX, - pippo.posY + 50, - pippo.posZ, "hbm:block.debris", 100F, 1F); + if(!bulletnt.worldObj.isRemote) { + EntityBuilding pippo = new EntityBuilding(bulletnt.worldObj); + pippo.posX = hit.posX; + pippo.posY = hit.posY + 50; + pippo.posZ = hit.posZ; + + for(int j = 0; j < 150; j++) { + EntityBSmokeFX fx = new EntityBSmokeFX(bulletnt.worldObj, pippo.posX + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 15, pippo.posY + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 15, pippo.posZ + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 15, 0, 0, 0); + bulletnt.worldObj.spawnEntityInWorld(fx); } + bulletnt.worldObj.spawnEntityInWorld(pippo); + + bulletnt.worldObj.playSoundEffect(pippo.posX, pippo.posY + 50, pippo.posZ, "hbm:block.debris", 100F, 1F); } - }; bullet.spentCasing = CASING44.clone().register("44Silver").setColor(0x2B5963); diff --git a/src/main/java/com/hbm/handler/guncfg/Gun4GaugeFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun4GaugeFactory.java index 191867b61..191c0eb93 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun4GaugeFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun4GaugeFactory.java @@ -3,7 +3,7 @@ package com.hbm.handler.guncfg; import java.util.ArrayList; import java.util.List; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.explosion.ExplosionLarge; import com.hbm.explosion.ExplosionNT; import com.hbm.explosion.ExplosionNT.ExAttrib; @@ -12,9 +12,6 @@ import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; import com.hbm.handler.CasingEjector; import com.hbm.handler.GunConfiguration; -import com.hbm.interfaces.IBulletHurtBehavior; -import com.hbm.interfaces.IBulletImpactBehavior; -import com.hbm.interfaces.IBulletUpdateBehavior; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.items.ModItems; import com.hbm.items.ItemAmmoEnums.Ammo4Gauge; @@ -33,7 +30,6 @@ import com.hbm.render.anim.HbmAnimations.AnimType; import com.hbm.render.util.RenderScreenOverlay.Crosshair; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -209,19 +205,15 @@ public class Gun4GaugeFactory { bullet.effects = new ArrayList(); bullet.effects.add(new PotionEffect(eff)); - bullet.bImpact = new IBulletImpactBehavior() { - - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", "vanillaburst"); - data.setString("mode", "flame"); - data.setInteger("count", 15); - data.setDouble("motion", 0.05D); - - PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50)); - } + bullet.bntImpact = (bulletnt, x, y, z) -> { + + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "vanillaburst"); + data.setString("mode", "flame"); + data.setInteger("count", 15); + data.setDouble("motion", 0.05D); + + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ), new TargetPoint(bulletnt.dimension, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 50)); }; bullet.spentCasing = CASING4GAUGE.clone().register("4GaPhos").setColor(0xF6871A, SpentCasing.COLOR_CASE_4GA); @@ -259,22 +251,18 @@ public class Gun4GaugeFactory { bullet.trail = 1; bullet.explosive = 0.0F; - bullet.bImpact = new IBulletImpactBehavior() { - - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - - if(bullet.worldObj.isRemote) - return; - - ExplosionNT explosion = new ExplosionNT(bullet.worldObj, null, bullet.posX, bullet.posY, bullet.posZ, 4); - explosion.atttributes.add(ExAttrib.ALLDROP); - explosion.atttributes.add(ExAttrib.NOHURT); - explosion.doExplosionA(); - explosion.doExplosionB(false); - - ExplosionLarge.spawnParticles(bullet.worldObj, bullet.posX, bullet.posY, bullet.posZ, 15); - } + bullet.bntImpact = (bulletnt, x, y, z) -> { + + if(bulletnt.worldObj.isRemote) + return; + + ExplosionNT explosion = new ExplosionNT(bulletnt.worldObj, null, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 4); + explosion.atttributes.add(ExAttrib.ALLDROP); + explosion.atttributes.add(ExAttrib.NOHURT); + explosion.doExplosionA(); + explosion.doExplosionB(false); + + ExplosionLarge.spawnParticles(bulletnt.worldObj, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 15); }; bullet.spentCasing = CASING4GAUGE.clone().register("4GaSem").setColor(0x5C5C5C, SpentCasing.COLOR_CASE_4GA); @@ -295,21 +283,17 @@ public class Gun4GaugeFactory { bullet.trail = 1; bullet.explosive = 0.0F; - bullet.bImpact = new IBulletImpactBehavior() { - - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - - if(bullet.worldObj.isRemote) - return; - - ExplosionNT explosion = new ExplosionNT(bullet.worldObj, null, bullet.posX, bullet.posY, bullet.posZ, 6); - explosion.atttributes.add(ExAttrib.BALEFIRE); - explosion.doExplosionA(); - explosion.doExplosionB(false); - - ExplosionLarge.spawnParticles(bullet.worldObj, bullet.posX, bullet.posY, bullet.posZ, 30); - } + bullet.bntImpact = (bulletnt, x, y, z) -> { + + if(bulletnt.worldObj.isRemote) + return; + + ExplosionNT explosion = new ExplosionNT(bulletnt.worldObj, null, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 6); + explosion.atttributes.add(ExAttrib.BALEFIRE); + explosion.doExplosionA(); + explosion.doExplosionB(false); + + ExplosionLarge.spawnParticles(bulletnt.worldObj, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 30); }; bullet.spentCasing = CASING4GAUGE.clone().register("4GaBale").setColor(0x7BFF44, SpentCasing.COLOR_CASE_4GA); @@ -348,23 +332,20 @@ public class Gun4GaugeFactory { bullet.trail = 4; bullet.vPFX = "smoke"; - bullet.bUpdate = new IBulletUpdateBehavior() { - - @Override - public void behaveUpdate(EntityBulletBase bullet) { + bullet.bntUpdate = (bulletnt) -> { + + if(!bulletnt.worldObj.isRemote) { - if(!bullet.worldObj.isRemote) { + if(bulletnt.ticksExisted > 10) { + bulletnt.setDead(); - if(bullet.ticksExisted > 10) { - bullet.setDead(); + for(int i = 0; i < 50; i++) { - for(int i = 0; i < 50; i++) { - - EntityBulletBase bolt = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.M44_AP); - bolt.setPosition(bullet.posX, bullet.posY, bullet.posZ); - bolt.setThrowableHeading(bullet.motionX, bullet.motionY, bullet.motionZ, 0.25F, 0.1F); - bullet.worldObj.spawnEntityInWorld(bolt); - } + EntityBulletBaseNT bolt = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.M44_AP); + bolt.setPosition(bulletnt.posX, bulletnt.posY, bulletnt.posZ); + bolt.setThrowableHeading(bulletnt.motionX, bulletnt.motionY, bulletnt.motionZ, 0.25F, 0.1F); + bolt.setThrower(bulletnt.getThrower()); + bulletnt.worldObj.spawnEntityInWorld(bolt); } } } @@ -397,25 +378,21 @@ public class Gun4GaugeFactory { bullet.bulletsMax *= 2; bullet.leadChance = 100; - bullet.bHurt = new IBulletHurtBehavior() { - - @Override - public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) { + bullet.bntHurt = (bulletnt, hit) -> { + + if(bulletnt.worldObj.isRemote) + return; + + if(hit instanceof EntityLivingBase) { + EntityLivingBase living = (EntityLivingBase) hit; + float f = living.getHealth(); - if(bullet.worldObj.isRemote) - return; - - if(hit instanceof EntityLivingBase) { - EntityLivingBase living = (EntityLivingBase) hit; - float f = living.getHealth(); + if(f > 0) { + f = Math.max(0, f - 2); + living.setHealth(f); - if(f > 0) { - f = Math.max(0, f - 2); - living.setHealth(f); - - if(f == 0) - living.onDeath(ModDamageSource.causeBulletDamage(bullet, hit)); - } + if(f == 0) + living.onDeath(ModDamageSource.causeBulletDamage(bulletnt, hit)); } } }; @@ -437,25 +414,21 @@ public class Gun4GaugeFactory { bullet.leadChance = 100; bullet.style = BulletConfiguration.STYLE_FLECHETTE; - bullet.bHurt = new IBulletHurtBehavior() { + bullet.bntHurt = (bulletnt, hit) -> { - @Override - public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) { - - if(bullet.worldObj.isRemote) - return; - - if(hit instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) hit; - - IExtendedEntityProperties prop = player.getExtendedProperties("WitcheryExtendedPlayer"); - - NBTTagCompound blank = new NBTTagCompound(); - blank.setTag("WitcheryExtendedPlayer", new NBTTagCompound()); - - if(prop != null) { - prop.loadNBTData(blank); - } + if(bulletnt.worldObj.isRemote) + return; + + if(hit instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) hit; + + IExtendedEntityProperties prop = player.getExtendedProperties("WitcheryExtendedPlayer"); + + NBTTagCompound blank = new NBTTagCompound(); + blank.setTag("WitcheryExtendedPlayer", new NBTTagCompound()); + + if(prop != null) { + prop.loadNBTData(blank); } } }; @@ -476,20 +449,16 @@ public class Gun4GaugeFactory { bullet.bulletsMax *= 2; bullet.leadChance = 0; - bullet.bHurt = new IBulletHurtBehavior() { + bullet.bntHurt = (bulletnt, hit) -> { + + if(bulletnt.worldObj.isRemote) + return; - @Override - public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) { - - if(bullet.worldObj.isRemote) - return; - - if(hit instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) hit; - - player.inventory.dropAllItems(); - player.worldObj.newExplosion(bullet.shooter, player.posX, player.posY, player.posZ, 5.0F, true, true); - } + if(hit instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) hit; + + player.inventory.dropAllItems(); + player.worldObj.newExplosion(bulletnt.getThrower(), player.posX, player.posY, player.posZ, 5.0F, true, true); } }; @@ -512,27 +481,20 @@ public class Gun4GaugeFactory { bullet.trail = 4; bullet.vPFX = "explode"; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = (bulletnt) -> { - @Override - public void behaveUpdate(EntityBulletBase bullet) { - - if(!bullet.worldObj.isRemote) { - - if(bullet.ticksExisted % 2 == 0) { - - List creatures = bullet.worldObj.getEntitiesWithinAABB(EntityCreature.class, bullet.boundingBox.expand(10, 10, 10)); - - for(EntityCreature creature : creatures) { - - if(creature.getClass().getCanonicalName().startsWith("net.minecraft.entity.titan")) { - BulletConfigFactory.nuclearExplosion(creature, 0, 0, 0, ExplosionNukeSmall.PARAMS_TOTS); + if(!bulletnt.worldObj.isRemote) { + if(bulletnt.ticksExisted % 2 == 0) { - bullet.worldObj.removeEntity(creature); - bullet.worldObj.unloadEntities(new ArrayList() {{ add(creature); }}); - } + List creatures = bulletnt.worldObj.getEntitiesWithinAABB(EntityCreature.class, bulletnt.boundingBox.expand(10, 10, 10)); + for(EntityCreature creature : creatures) { + + if(creature.getClass().getCanonicalName().startsWith("net.minecraft.entity.titan")) { + BulletConfigFactory.nuclearExplosion(creature, 0, 0, 0, ExplosionNukeSmall.PARAMS_TOTS); + + bulletnt.worldObj.removeEntity(creature); + bulletnt.worldObj.unloadEntities(new ArrayList() {{ add(creature); }}); } - } } } diff --git a/src/main/java/com/hbm/handler/guncfg/Gun50BMGFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun50BMGFactory.java index c7d290c35..beda66771 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun50BMGFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun50BMGFactory.java @@ -2,13 +2,11 @@ package com.hbm.handler.guncfg; import java.util.ArrayList; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; import com.hbm.handler.CasingEjector; import com.hbm.handler.GunConfiguration; -import com.hbm.interfaces.IBulletHitBehavior; -import com.hbm.interfaces.IBulletImpactBehavior; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.items.ModItems; import com.hbm.items.ItemAmmoEnums.Ammo50BMG; @@ -31,7 +29,6 @@ import com.hbm.util.ContaminationUtil.ContaminationType; import com.hbm.util.ContaminationUtil.HazardType; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; @@ -65,7 +62,7 @@ public class Gun50BMGFactory { bullet.leadChance = 20; bullet.blockDamage = false; - bullet.bImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 2.0F, false, false); + bullet.bntImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 2.0F, false, false); bullet.spentCasing = CASINGLUNA.clone().register("LunaStock"); @@ -79,7 +76,7 @@ public class Gun50BMGFactory { bullet.ammo.meta = 1; bullet.incendiary = 10; - bullet.bImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 5.0F, true, false); + bullet.bntImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 5.0F, true, false); bullet.spentCasing = CASINGLUNA.clone().register("LunaInc"); @@ -94,7 +91,7 @@ public class Gun50BMGFactory { bullet.ammo.meta = 2; bullet.explosive = 25; bullet.destroysBlocks = true; - bullet.bImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 25.0F, true, false); + bullet.bntImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 25.0F, true, false); bullet.spentCasing = CASINGLUNA.clone().register("LunaExp"); @@ -267,19 +264,15 @@ public class Gun50BMGFactory { bullet.effects = new ArrayList(); bullet.effects.add(new PotionEffect(eff)); - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = (bulletnt, x, y, z) -> { - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", "vanillaburst"); - data.setString("mode", "flame"); - data.setInteger("count", 15); - data.setDouble("motion", 0.05D); - - PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50)); - } + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "vanillaburst"); + data.setString("mode", "flame"); + data.setInteger("count", 15); + data.setDouble("motion", 0.05D); + + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ), new TargetPoint(bulletnt.dimension, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 50)); }; bullet.spentCasing = CASING50BMG.clone().register("50BMGPhos"); @@ -363,39 +356,31 @@ public class Gun50BMGFactory { bullet.leadChance = 100; bullet.doesPenetrate = false; - bullet.bHit = new IBulletHitBehavior() { + bullet.bntHit = (bulletnt, hit) -> { - @Override - public void behaveEntityHit(EntityBulletBase bullet, Entity hit) { - - if(bullet.worldObj.isRemote) - return; - - EntityBulletBase meteor = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR); - meteor.setPosition(hit.posX, hit.posY + 30 + meteor.worldObj.rand.nextInt(10), hit.posZ); - meteor.motionY = -1D; - meteor.shooter = bullet.shooter; - bullet.worldObj.spawnEntityInWorld(meteor); - } + if(bulletnt.worldObj.isRemote) + return; + + EntityBulletBaseNT meteor = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR); + meteor.setPosition(hit.posX, hit.posY + 30 + meteor.worldObj.rand.nextInt(10), hit.posZ); + meteor.motionY = -1D; + meteor.setThrower(bulletnt.getThrower()); + bulletnt.worldObj.spawnEntityInWorld(meteor); }; - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = (bulletnt, x, y, z) -> { - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - - if(bullet.worldObj.isRemote) - return; - - if(y == -1) - return; - - EntityBulletBase meteor = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR); - meteor.setPosition(bullet.posX, bullet.posY + 30 + meteor.worldObj.rand.nextInt(10), bullet.posZ); - meteor.motionY = -1D; - meteor.shooter = bullet.shooter; - bullet.worldObj.spawnEntityInWorld(meteor); - } + if(bulletnt.worldObj.isRemote) + return; + + if(y == -1) + return; + + EntityBulletBaseNT meteor = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR); + meteor.setPosition(bulletnt.posX, bulletnt.posY + 30 + meteor.worldObj.rand.nextInt(10), bulletnt.posZ); + meteor.motionY = -1D; + meteor.setThrower(bulletnt.getThrower()); + bulletnt.worldObj.spawnEntityInWorld(meteor); }; bullet.spentCasing = CASING50BMG.clone().register("50BMGIF"); @@ -428,17 +413,13 @@ public class Gun50BMGFactory { bullet.dmgMax = 64; bullet.style = bullet.STYLE_FLECHETTE; - bullet.bHit = new IBulletHitBehavior() { + bullet.bntHit = (bulletnt, hit) -> { - @Override - public void behaveEntityHit(EntityBulletBase bullet, Entity hit) { - - if(bullet.worldObj.isRemote) - return; - - if(hit instanceof EntityLivingBase) { - ContaminationUtil.contaminate((EntityLivingBase) hit, HazardType.RADIATION, ContaminationType.RAD_BYPASS, 100F); - } + if(bulletnt.worldObj.isRemote) + return; + + if(hit instanceof EntityLivingBase) { + ContaminationUtil.contaminate((EntityLivingBase) hit, HazardType.RADIATION, ContaminationType.RAD_BYPASS, 100F); } }; @@ -457,17 +438,13 @@ public class Gun50BMGFactory { bullet.dmgMax = 64; bullet.style = bullet.STYLE_FLECHETTE; - bullet.bHit = new IBulletHitBehavior() { + bullet.bntHit = (bulletnt, hit) -> { - @Override - public void behaveEntityHit(EntityBulletBase bullet, Entity hit) { - - if(bullet.worldObj.isRemote) - return; - - if(hit instanceof EntityLivingBase) { - ContaminationUtil.contaminate((EntityLivingBase) hit, HazardType.RADIATION, ContaminationType.RAD_BYPASS, 50F); - } + if(bulletnt.worldObj.isRemote) + return; + + if(hit instanceof EntityLivingBase) { + ContaminationUtil.contaminate((EntityLivingBase) hit, HazardType.RADIATION, ContaminationType.RAD_BYPASS, 50F); } }; diff --git a/src/main/java/com/hbm/handler/guncfg/Gun556mmFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun556mmFactory.java index dec4e5b73..d983998e8 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun556mmFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun556mmFactory.java @@ -2,13 +2,11 @@ package com.hbm.handler.guncfg; import java.util.ArrayList; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; import com.hbm.handler.CasingEjector; import com.hbm.handler.GunConfiguration; -import com.hbm.interfaces.IBulletHitBehavior; -import com.hbm.interfaces.IBulletImpactBehavior; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.items.ItemAmmoEnums.Ammo556mm; import com.hbm.items.ModItems; @@ -26,7 +24,6 @@ import com.hbm.render.anim.HbmAnimations.AnimType; import com.hbm.render.util.RenderScreenOverlay.Crosshair; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; @@ -185,19 +182,15 @@ public class Gun556mmFactory { bullet.effects = new ArrayList(); bullet.effects.add(new PotionEffect(eff)); - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = (bulletnt, x, y, z) -> { - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", "vanillaburst"); - data.setString("mode", "flame"); - data.setInteger("count", 15); - data.setDouble("motion", 0.05D); - - PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50)); - } + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "vanillaburst"); + data.setString("mode", "flame"); + data.setInteger("count", 15); + data.setDouble("motion", 0.05D); + + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ), new TargetPoint(bulletnt.dimension, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 50)); }; bullet.spentCasing = CASING556.clone().register("556Phos"); @@ -261,39 +254,31 @@ public class Gun556mmFactory { bullet.leadChance = 100; bullet.doesPenetrate = false; - bullet.bHit = new IBulletHitBehavior() { + bullet.bntHit = (bulletnt, hit) -> { - @Override - public void behaveEntityHit(EntityBulletBase bullet, Entity hit) { - - if(bullet.worldObj.isRemote) - return; - - EntityBulletBase meteor = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR); - meteor.setPosition(hit.posX, hit.posY + 30 + meteor.worldObj.rand.nextInt(10), hit.posZ); - meteor.motionY = -1D; - meteor.shooter = bullet.shooter; - bullet.worldObj.spawnEntityInWorld(meteor); - } + if(bulletnt.worldObj.isRemote) + return; + + EntityBulletBaseNT meteor = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR); + meteor.setPosition(hit.posX, hit.posY + 30 + meteor.worldObj.rand.nextInt(10), hit.posZ); + meteor.motionY = -1D; + meteor.setThrower(bulletnt.getThrower()); + bulletnt.worldObj.spawnEntityInWorld(meteor); }; - - bullet.bImpact = new IBulletImpactBehavior() { - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - - if(bullet.worldObj.isRemote) - return; - - if(y == -1) - return; - - EntityBulletBase meteor = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR); - meteor.setPosition(bullet.posX, bullet.posY + 30 + meteor.worldObj.rand.nextInt(10), bullet.posZ); - meteor.motionY = -1D; - meteor.shooter = bullet.shooter; - bullet.worldObj.spawnEntityInWorld(meteor); - } + bullet.bntImpact = (bulletnt, x, y, z) -> { + + if(bulletnt.worldObj.isRemote) + return; + + if(y == -1) + return; + + EntityBulletBaseNT meteor = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR); + meteor.setPosition(bulletnt.posX, bulletnt.posY + 30 + meteor.worldObj.rand.nextInt(10), bulletnt.posZ); + meteor.motionY = -1D; + meteor.setThrower(bulletnt.getThrower()); + bulletnt.worldObj.spawnEntityInWorld(meteor); }; bullet.spentCasing = CASING556.clone().register("556IF"); @@ -355,19 +340,15 @@ public class Gun556mmFactory { bullet.effects = new ArrayList(); bullet.effects.add(new PotionEffect(eff)); - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = (bulletnt, x, y, z) -> { - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", "vanillaburst"); - data.setString("mode", "flame"); - data.setInteger("count", 15); - data.setDouble("motion", 0.05D); - - PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50)); - } + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "vanillaburst"); + data.setString("mode", "flame"); + data.setInteger("count", 15); + data.setDouble("motion", 0.05D); + + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ), new TargetPoint(bulletnt.dimension, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 50)); }; bullet.spentCasing = CASING556.clone().register("556FlecPhos"); @@ -402,39 +383,31 @@ public class Gun556mmFactory { bullet.leadChance = 50; bullet.doesPenetrate = false; - bullet.bHit = new IBulletHitBehavior() { + bullet.bntHit = (bulletnt, hit) -> { - @Override - public void behaveEntityHit(EntityBulletBase bullet, Entity hit) { - - if(bullet.worldObj.isRemote) - return; - - EntityBulletBase meteor = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR); - meteor.setPosition(hit.posX, hit.posY + 30 + meteor.worldObj.rand.nextInt(10), hit.posZ); - meteor.motionY = -1D; - meteor.shooter = bullet.shooter; - bullet.worldObj.spawnEntityInWorld(meteor); - } + if(bulletnt.worldObj.isRemote) + return; + + EntityBulletBaseNT meteor = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR); + meteor.setPosition(hit.posX, hit.posY + 30 + meteor.worldObj.rand.nextInt(10), hit.posZ); + meteor.motionY = -1D; + meteor.setThrower(bulletnt.getThrower()); + bulletnt.worldObj.spawnEntityInWorld(meteor); }; - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = (bulletnt, x, y, z) -> { - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - - if(bullet.worldObj.isRemote) - return; - - if(y == -1) - return; - - EntityBulletBase meteor = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR); - meteor.setPosition(bullet.posX, bullet.posY + 30 + meteor.worldObj.rand.nextInt(10), bullet.posZ); - meteor.motionY = -1D; - meteor.shooter = bullet.shooter; - bullet.worldObj.spawnEntityInWorld(meteor); - } + if(bulletnt.worldObj.isRemote) + return; + + if(y == -1) + return; + + EntityBulletBaseNT meteor = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR); + meteor.setPosition(bulletnt.posX, bulletnt.posY + 30 + meteor.worldObj.rand.nextInt(10), bulletnt.posZ); + meteor.motionY = -1D; + meteor.setThrower(bulletnt.getThrower()); + bulletnt.worldObj.spawnEntityInWorld(meteor); }; bullet.spentCasing = CASING556.clone().register("556FlecIF"); diff --git a/src/main/java/com/hbm/handler/guncfg/Gun75BoltFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun75BoltFactory.java index 89d7f2c7c..b3d9bae6f 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun75BoltFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun75BoltFactory.java @@ -2,11 +2,8 @@ package com.hbm.handler.guncfg; import java.util.ArrayList; -import com.hbm.entity.projectile.EntityBulletBase; 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.ItemAmmoEnums.Ammo75Bolt; import com.hbm.items.ModItems; @@ -23,7 +20,6 @@ import com.hbm.render.anim.HbmAnimations.AnimType; import com.hbm.render.util.RenderScreenOverlay.Crosshair; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; @@ -96,25 +92,21 @@ public class Gun75BoltFactory { bullet.doesRicochet = false; bullet.explosive = 0.25F; - bullet.bHurt = new IBulletHurtBehavior() { + bullet.bntHurt = (bulletnt, hit) -> { - @Override - public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) { - - if(bullet.worldObj.isRemote) - return; - - if(hit instanceof EntityLivingBase) { - EntityLivingBase living = (EntityLivingBase) hit; - float f = living.getHealth(); - - if(f > 0) { - f = Math.max(0, f - 2); - living.setHealth(f); - - if(f == 0) - living.onDeath(ModDamageSource.lead); - } + if(bulletnt.worldObj.isRemote) + return; + + if(hit instanceof EntityLivingBase) { + EntityLivingBase living = (EntityLivingBase) hit; + float f = living.getHealth(); + + if(f > 0) { + f = Math.max(0, f - 2); + living.setHealth(f); + + if(f == 0) + living.onDeath(ModDamageSource.lead); } } }; @@ -142,19 +134,15 @@ public class Gun75BoltFactory { bullet.effects = new ArrayList(); bullet.effects.add(new PotionEffect(eff)); - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = (bulletnt, x, y, z) -> { - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", "vanillaburst"); - data.setString("mode", "flame"); - data.setInteger("count", 15); - data.setDouble("motion", 0.05D); - - PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50)); - } + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "vanillaburst"); + data.setString("mode", "flame"); + data.setInteger("count", 15); + data.setDouble("motion", 0.05D); + + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ), new TargetPoint(bulletnt.dimension, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 50)); }; return bullet; diff --git a/src/main/java/com/hbm/handler/guncfg/GunCannonFactory.java b/src/main/java/com/hbm/handler/guncfg/GunCannonFactory.java index 42a79013e..2d8710522 100644 --- a/src/main/java/com/hbm/handler/guncfg/GunCannonFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/GunCannonFactory.java @@ -1,9 +1,7 @@ package com.hbm.handler.guncfg; -import com.hbm.entity.projectile.EntityBulletBase; import com.hbm.explosion.ExplosionNukeSmall; import com.hbm.handler.BulletConfiguration; -import com.hbm.interfaces.IBulletImpactBehavior; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.items.ItemAmmoEnums.Ammo240Shell; import com.hbm.items.ModItems; @@ -86,12 +84,8 @@ public class GunCannonFactory { bullet.dmgMin = 100; bullet.dmgMax = 150; - bullet.bImpact = new IBulletImpactBehavior() { - - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_TOTS); - } + bullet.bntImpact = (bulletnt, x, y, z) -> { + BulletConfigFactory.nuclearExplosion(bulletnt, x, y, z, ExplosionNukeSmall.PARAMS_TOTS); }; bullet.spentCasing = CASINNG240MM; diff --git a/src/main/java/com/hbm/handler/guncfg/GunDartFactory.java b/src/main/java/com/hbm/handler/guncfg/GunDartFactory.java index 70c743232..07bcc2878 100644 --- a/src/main/java/com/hbm/handler/guncfg/GunDartFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/GunDartFactory.java @@ -2,12 +2,10 @@ package com.hbm.handler.guncfg; import java.util.ArrayList; -import com.hbm.entity.projectile.EntityBulletBase; import com.hbm.extprop.HbmLivingProps; 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.ItemAmmoEnums.AmmoDart; import com.hbm.items.ModItems; @@ -16,7 +14,6 @@ import com.hbm.lib.HbmCollection.EnumGunManufacturer; import com.hbm.main.MainRegistry; import com.hbm.render.util.RenderScreenOverlay.Crosshair; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; @@ -103,27 +100,23 @@ public class GunDartFactory { bullet.effects = new ArrayList(); bullet.effects.add(new PotionEffect(Potion.wither.id, 60 * 20, 2)); - bullet.bHurt = new IBulletHurtBehavior() { + bullet.bntHurt = (bulletnt, hit) -> { - @Override - public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) { - - if(bullet.worldObj.isRemote) + if(bulletnt.worldObj.isRemote) + return; + + if(hit instanceof EntityPlayer) { + + if(((EntityPlayer) hit).inventory.hasItem(ModItems.ingot_meteorite_forged)) return; - - if(hit instanceof EntityPlayer) { - - if(((EntityPlayer) hit).inventory.hasItem(ModItems.ingot_meteorite_forged)) - return; - - if(bullet.shooter instanceof EntityPlayer) { - - EntityPlayer shooter = (EntityPlayer) bullet.shooter; - - if(shooter.getHeldItem() != null && shooter.getHeldItem().getItem() == ModItems.gun_darter) { - ItemGunDart.writePlayer(shooter.getHeldItem(), (EntityPlayer)hit); - shooter.playSound("random.orb", 1.0F, 1.0F); - } + + if(bulletnt.getThrower() instanceof EntityPlayer) { + + EntityPlayer shooter = (EntityPlayer) bulletnt.getThrower(); + + if(shooter.getHeldItem() != null && shooter.getHeldItem().getItem() == ModItems.gun_darter) { + ItemGunDart.writePlayer(shooter.getHeldItem(), (EntityPlayer) hit); + shooter.playSound("random.orb", 1.0F, 1.0F); } } } @@ -146,23 +139,19 @@ public class GunDartFactory { bullet.style = bullet.STYLE_FLECHETTE; bullet.leadChance = 0; - bullet.bHurt = new IBulletHurtBehavior() { + bullet.bntHurt = (bulletnt, hit) -> { - @Override - public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) { - - if(bullet.worldObj.isRemote) - return; - - if(hit instanceof EntityLivingBase) { - - EntityLivingBase e = (EntityLivingBase) hit; + if(bulletnt.worldObj.isRemote) + return; - if(HbmLivingProps.getRadiation(e) < 250) - HbmLivingProps.setRadiation(e, 250); - if(HbmLivingProps.getTimer(e) <= 0) - HbmLivingProps.setTimer(e, MainRegistry.polaroidID * 60 * 20); - } + if(hit instanceof EntityLivingBase) { + + EntityLivingBase e = (EntityLivingBase) hit; + + if(HbmLivingProps.getRadiation(e) < 250) + HbmLivingProps.setRadiation(e, 250); + if(HbmLivingProps.getTimer(e) <= 0) + HbmLivingProps.setTimer(e, MainRegistry.polaroidID * 60 * 20); } }; diff --git a/src/main/java/com/hbm/handler/guncfg/GunDetonatorFactory.java b/src/main/java/com/hbm/handler/guncfg/GunDetonatorFactory.java index dad35a32a..ab25f43bc 100644 --- a/src/main/java/com/hbm/handler/guncfg/GunDetonatorFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/GunDetonatorFactory.java @@ -2,14 +2,12 @@ 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.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; @@ -90,22 +88,20 @@ public class GunDetonatorFactory { bullet.doesRicochet = false; bullet.setToBolt(BulletConfiguration.BOLT_LASER); - bullet.bImpact = new IBulletImpactBehavior() { - - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + bullet.bntImpact = (bulletnt, x, y, z) -> { - World world = bullet.worldObj; - if(!world.isRemote && y > 0) { - Block b = world.getBlock(x, y, z); - if(b instanceof IBomb) { - BombReturnCode ret = ((IBomb)b).explode(world, x, y, z); - - if(ret.wasSuccessful() && bullet.shooter instanceof EntityPlayerMP) { - EntityPlayerMP player = (EntityPlayerMP) bullet.shooter; - world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F); - PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("").nextTranslation(ret.getUnlocalizedMessage()).color(EnumChatFormatting.YELLOW).flush(), MainRegistry.proxy.ID_DETONATOR), (EntityPlayerMP) player); - } + World world = bulletnt.worldObj; + if(!world.isRemote && y > 0) { + Block b = world.getBlock(x, y, z); + if(b instanceof IBomb) { + BombReturnCode ret = ((IBomb) b).explode(world, x, y, z); + + if(ret.wasSuccessful() && bulletnt.getThrower() instanceof EntityPlayerMP) { + EntityPlayerMP player = (EntityPlayerMP) bulletnt.getThrower(); + world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F); + PacketDispatcher.wrapper.sendTo( + new PlayerInformPacket(ChatBuilder.start("").nextTranslation(ret.getUnlocalizedMessage()).color(EnumChatFormatting.YELLOW).flush(), MainRegistry.proxy.ID_DETONATOR), + (EntityPlayerMP) player); } } } diff --git a/src/main/java/com/hbm/handler/guncfg/GunEnergyFactory.java b/src/main/java/com/hbm/handler/guncfg/GunEnergyFactory.java index 1ecf00f06..1e7d4342d 100644 --- a/src/main/java/com/hbm/handler/guncfg/GunEnergyFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/GunEnergyFactory.java @@ -3,15 +3,16 @@ package com.hbm.handler.guncfg; import java.util.ArrayList; import com.hbm.blocks.ModBlocks; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; +import com.hbm.entity.projectile.EntityBulletBaseNT.IBulletImpactBehaviorNT; +import com.hbm.entity.projectile.EntityBulletBaseNT.IBulletUpdateBehaviorNT; import com.hbm.explosion.ExplosionChaos; import com.hbm.explosion.ExplosionLarge; import com.hbm.handler.BulletConfigSyncingUtil; 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.ItemAmmoEnums.AmmoCoilgun; import com.hbm.items.ItemAmmoEnums.AmmoFireExt; import com.hbm.items.ItemAmmoEnums.AmmoFlamethrower; import com.hbm.items.ModItems; @@ -19,6 +20,7 @@ import com.hbm.lib.HbmCollection.EnumGunManufacturer; import com.hbm.lib.ModDamageSource; import com.hbm.main.MainRegistry; import com.hbm.packet.AuxParticlePacketNT; +import com.hbm.packet.ExplosionKnockbackPacket; import com.hbm.packet.PacketDispatcher; import com.hbm.potion.HbmPotion; import com.hbm.render.util.RenderScreenOverlay.Crosshair; @@ -29,11 +31,13 @@ import com.hbm.util.CompatExternal; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Vec3; public class GunEnergyFactory { @@ -203,7 +207,9 @@ public class GunEnergyFactory { config.manufacturer = EnumGunManufacturer.DRG; config.config = new ArrayList(); - config.config.add(BulletConfigSyncingUtil.SPECIAL_COIL); + config.config.add(BulletConfigSyncingUtil.COIL_NORMAL); + config.config.add(BulletConfigSyncingUtil.COIL_DU); + config.config.add(BulletConfigSyncingUtil.COIL_RUBBER); return config; } @@ -277,9 +283,9 @@ public class GunEnergyFactory { BulletConfiguration bullet = new BulletConfiguration(); - bullet.ammo = new ComparableStack(ModItems.gun_coilgun_ammo); + bullet.ammo = new ComparableStack(ModItems.ammo_coilgun, 1, AmmoCoilgun.STOCK.ordinal()); - bullet.velocity = 5F; + bullet.velocity = 7.5F; bullet.spread = 0.0F; bullet.wear = 10; bullet.bulletsMin = 1; @@ -287,7 +293,7 @@ public class GunEnergyFactory { bullet.dmgMin = 35; bullet.dmgMax = 45; bullet.gravity = 0D; - bullet.maxAge = 100; + bullet.maxAge = 50; bullet.doesPenetrate = true; bullet.isSpectral = true; @@ -295,9 +301,105 @@ public class GunEnergyFactory { bullet.trail = bullet.BOLT_NIGHTMARE; bullet.vPFX = "fireworks"; + bullet.bntUpdate = (entity) -> breakInPath(entity, 1.25F); + return bullet; } + public static BulletConfiguration getCoilDUConfig() { + + BulletConfiguration bullet = new BulletConfiguration(); + + bullet.ammo = new ComparableStack(ModItems.ammo_coilgun, 1, AmmoCoilgun.DU.ordinal()); + + bullet.velocity = 7.5F; + bullet.spread = 0.0F; + bullet.wear = 25; + bullet.bulletsMin = 1; + bullet.bulletsMax = 1; + bullet.dmgMin = 65; + bullet.dmgMax = 80; + bullet.gravity = 0D; + bullet.maxAge = 50; + bullet.doesPenetrate = true; + bullet.isSpectral = true; + + bullet.style = bullet.STYLE_BOLT; + bullet.trail = bullet.BOLT_NIGHTMARE; + bullet.vPFX = "fireworks"; + + bullet.bntUpdate = (entity) -> breakInPath(entity, 2.5F); + + return bullet; + } + + public static BulletConfiguration getCoilRubberConfig() { + + BulletConfiguration bullet = new BulletConfiguration(); + + bullet.ammo = new ComparableStack(ModItems.ammo_coilgun, 1, AmmoCoilgun.RUBBER.ordinal()); + + bullet.velocity = 5F; + bullet.spread = 0.0F; + bullet.wear = 10; + bullet.bulletsMin = 1; + bullet.bulletsMax = 1; + bullet.dmgMin = 10; + bullet.dmgMax = 20; + bullet.gravity = 0D; + bullet.maxAge = 50; + bullet.doesPenetrate = false; + bullet.isSpectral = false; + bullet.doesRicochet = true; + bullet.ricochetAngle = 30; + bullet.HBRC = 90; + bullet.LBRC = 100; + bullet.bounceMod = 1; + bullet.selfDamageDelay = 2; + + bullet.style = bullet.STYLE_PELLET; + + bullet.bntHurt = (entity, hit) -> { + Vec3 vec = Vec3.createVectorHelper(entity.motionX, entity.motionY, entity.motionZ); + vec = vec.normalize(); + vec.xCoord *= 10; + vec.yCoord *= 10; + vec.zCoord *= 10; + hit.motionX += vec.xCoord; + hit.motionY += vec.yCoord; + hit.motionZ += vec.zCoord; + + if(hit instanceof EntityPlayerMP) { + PacketDispatcher.wrapper.sendTo(new ExplosionKnockbackPacket(vec), (EntityPlayerMP) hit); + } + }; + + return bullet; + } + + public static void breakInPath(EntityBulletBaseNT entity, float threshold) { + + if(entity.worldObj.isRemote) return; + + Vec3 vec = Vec3.createVectorHelper(entity.posX - entity.prevPosX, entity.posY - entity.prevPosY, entity.posZ - entity.prevPosZ); + double motion = Math.max(vec.lengthVector(), 0.1); + vec = vec.normalize(); + + for(double d = 0; d < motion; d += 0.5) { + + int x = (int) Math.floor(entity.posX - vec.xCoord * d); + int y = (int) Math.floor(entity.posY - vec.yCoord * d); + int z = (int) Math.floor(entity.posZ - vec.zCoord * d); + + Block b = entity.worldObj.getBlock(x, y, z); + float hardness = b.getBlockHardness(entity.worldObj, x, y, z); + + if(b.getMaterial() != Material.air && hardness >= 0 && hardness < threshold) { + entity.worldObj.func_147480_a(x, y, z, false); + } + } + } + public static BulletConfiguration getFlameConfig() { BulletConfiguration bullet = new BulletConfiguration(); @@ -326,10 +428,10 @@ public class GunEnergyFactory { bullet.dmgProj = false; bullet.dmgFire = true; - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { if(!bullet.worldObj.isRemote) { NBTTagCompound data = new NBTTagCompound(); @@ -373,7 +475,7 @@ public class GunEnergyFactory { bullet.maxAge = 200; bullet.vPFX = "smoke"; - bullet.bImpact = BulletConfigFactory.getPhosphorousEffect(5, 60 * 20, 25, 0.25, 0.1F); + bullet.bntImpact = BulletConfigFactory.getPhosphorousEffect(5, 60 * 20, 25, 0.25, 0.1F); return bullet; } @@ -420,7 +522,7 @@ public class GunEnergyFactory { bullet.dmgFire = false; - bullet.bImpact = BulletConfigFactory.getGasEffect(5, 60 * 20); + bullet.bntImpact = BulletConfigFactory.getGasEffect(5, 60 * 20); return bullet; } @@ -447,12 +549,12 @@ public class GunEnergyFactory { bullet.style = BulletConfiguration.STYLE_NONE; bullet.plink = BulletConfiguration.PLINK_NONE; - bullet.bHurt = (bulletEntity, target) -> { target.extinguish(); }; + bullet.bntHurt = (bulletEntity, target) -> { target.extinguish(); }; - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { if(!bullet.worldObj.isRemote) { @@ -485,10 +587,10 @@ public class GunEnergyFactory { } }; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = new IBulletUpdateBehaviorNT() { @Override - public void behaveUpdate(EntityBulletBase bullet) { + public void behaveUpdate(EntityBulletBaseNT bullet) { if(bullet.worldObj.isRemote) { @@ -527,10 +629,10 @@ public class GunEnergyFactory { bullet.ammo = new ComparableStack(ModItems.ammo_fireext.stackFromEnum(AmmoFireExt.FOAM)); bullet.spread = 0.05F; - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { if(!bullet.worldObj.isRemote) { @@ -582,10 +684,10 @@ public class GunEnergyFactory { } }; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = new IBulletUpdateBehaviorNT() { @Override - public void behaveUpdate(EntityBulletBase bullet) { + public void behaveUpdate(EntityBulletBaseNT bullet) { if(bullet.worldObj.isRemote) { @@ -614,12 +716,12 @@ public class GunEnergyFactory { bullet.ammo = new ComparableStack(ModItems.ammo_fireext.stackFromEnum(AmmoFireExt.SAND)); bullet.spread = 0.1F; - bullet.bHurt = null; // does not extinguish entities + bullet.bntHurt = null; // does not extinguish entities - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { if(!bullet.worldObj.isRemote) { @@ -655,10 +757,10 @@ public class GunEnergyFactory { } }; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = new IBulletUpdateBehaviorNT() { @Override - public void behaveUpdate(EntityBulletBase bullet) { + public void behaveUpdate(EntityBulletBaseNT bullet) { if(bullet.worldObj.isRemote) { @@ -707,10 +809,10 @@ public class GunEnergyFactory { bullet.effects = new ArrayList(); bullet.effects.add(new PotionEffect(HbmPotion.bang.id, 10 * 20, 0)); - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { if(!bullet.worldObj.isRemote) { ExplosionChaos.explodeZOMG(bullet.worldObj, (int)Math.floor(bullet.posX), (int)Math.floor(bullet.posY), (int)Math.floor(bullet.posZ), 5); diff --git a/src/main/java/com/hbm/handler/guncfg/GunFatmanFactory.java b/src/main/java/com/hbm/handler/guncfg/GunFatmanFactory.java index 0e8dbbd24..e068b15f4 100644 --- a/src/main/java/com/hbm/handler/guncfg/GunFatmanFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/GunFatmanFactory.java @@ -3,7 +3,8 @@ package com.hbm.handler.guncfg; import java.util.ArrayList; import com.hbm.blocks.ModBlocks; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; +import com.hbm.entity.projectile.EntityBulletBaseNT.*; import com.hbm.explosion.ExplosionLarge; import com.hbm.explosion.ExplosionNT; import com.hbm.explosion.ExplosionNukeSmall; @@ -12,8 +13,6 @@ import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; 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.items.ItemAmmoEnums.AmmoFatman; @@ -133,10 +132,10 @@ public class GunFatmanFactory { BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig(); bullet.ammo = new ComparableStack(ModItems.ammo_nuke.stackFromEnum(AmmoFatman.STOCK)); - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_MEDIUM); } }; @@ -149,10 +148,10 @@ public class GunFatmanFactory { BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig(); bullet.ammo = new ComparableStack(ModItems.ammo_nuke.stackFromEnum(AmmoFatman.LOW)); - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_LOW); } }; @@ -165,10 +164,10 @@ public class GunFatmanFactory { BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig(); bullet.ammo = new ComparableStack(ModItems.ammo_nuke.stackFromEnum(AmmoFatman.HIGH)); - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_HIGH); } }; @@ -185,10 +184,10 @@ public class GunFatmanFactory { bullet.spread = 0.1F; bullet.style = bullet.STYLE_GRENADE; - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_TOTS); } }; @@ -201,10 +200,10 @@ public class GunFatmanFactory { BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig(); bullet.ammo = new ComparableStack(ModItems.ammo_nuke.stackFromEnum(AmmoFatman.SAFE)); - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_SAFE); } }; @@ -218,10 +217,10 @@ public class GunFatmanFactory { bullet.ammo = new ComparableStack(ModItems.ammo_nuke.stackFromEnum(AmmoFatman.PUMPKIN)); bullet.explosive = 10F; - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { if(!bullet.worldObj.isRemote) { @@ -250,10 +249,10 @@ public class GunFatmanFactory { bullet.explosive = 3F; bullet.style = bullet.STYLE_BARREL; - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = new IBulletImpactBehaviorNT() { @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { if(!bullet.worldObj.isRemote) { @@ -308,10 +307,10 @@ public class GunFatmanFactory { bullet.style = BulletConfiguration.STYLE_MIRV; bullet.velocity *= 3; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = new IBulletUpdateBehaviorNT() { @Override - public void behaveUpdate(EntityBulletBase bullet) { + public void behaveUpdate(EntityBulletBaseNT bullet) { if(bullet.worldObj.isRemote) return; @@ -321,7 +320,7 @@ public class GunFatmanFactory { for(int i = 0; i < 6; i++) { - EntityBulletBase nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_NORMAL); + EntityBulletBaseNT nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_NORMAL); nuke.setPosition(bullet.posX, bullet.posY, bullet.posZ); double mod = 0.1D; nuke.motionX = bullet.worldObj.rand.nextGaussian() * mod; @@ -345,10 +344,10 @@ public class GunFatmanFactory { bullet.style = BulletConfiguration.STYLE_MIRV; bullet.velocity *= 3; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = new IBulletUpdateBehaviorNT() { @Override - public void behaveUpdate(EntityBulletBase bullet) { + public void behaveUpdate(EntityBulletBaseNT bullet) { if(bullet.worldObj.isRemote) return; @@ -358,7 +357,7 @@ public class GunFatmanFactory { for(int i = 0; i < 6; i++) { - EntityBulletBase nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_LOW); + EntityBulletBaseNT nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_LOW); nuke.setPosition(bullet.posX, bullet.posY, bullet.posZ); double mod = 0.1D; nuke.motionX = bullet.worldObj.rand.nextGaussian() * mod; @@ -382,10 +381,10 @@ public class GunFatmanFactory { bullet.style = BulletConfiguration.STYLE_MIRV; bullet.velocity *= 3; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = new IBulletUpdateBehaviorNT() { @Override - public void behaveUpdate(EntityBulletBase bullet) { + public void behaveUpdate(EntityBulletBaseNT bullet) { if(bullet.worldObj.isRemote) return; @@ -395,7 +394,7 @@ public class GunFatmanFactory { for(int i = 0; i < 6; i++) { - EntityBulletBase nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_HIGH); + EntityBulletBaseNT nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_HIGH); nuke.setPosition(bullet.posX, bullet.posY, bullet.posZ); double mod = 0.1D; nuke.motionX = bullet.worldObj.rand.nextGaussian() * mod; @@ -419,10 +418,10 @@ public class GunFatmanFactory { bullet.style = BulletConfiguration.STYLE_MIRV; bullet.velocity *= 3; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = new IBulletUpdateBehaviorNT() { @Override - public void behaveUpdate(EntityBulletBase bullet) { + public void behaveUpdate(EntityBulletBaseNT bullet) { if(bullet.worldObj.isRemote) return; @@ -432,7 +431,7 @@ public class GunFatmanFactory { for(int i = 0; i < 6; i++) { - EntityBulletBase nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_SAFE); + EntityBulletBaseNT nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_SAFE); nuke.setPosition(bullet.posX, bullet.posY, bullet.posZ); double mod = 0.1D; nuke.motionX = bullet.worldObj.rand.nextGaussian() * mod; @@ -456,10 +455,10 @@ public class GunFatmanFactory { bullet.style = BulletConfiguration.STYLE_MIRV; bullet.velocity *= 3; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = new IBulletUpdateBehaviorNT() { @Override - public void behaveUpdate(EntityBulletBase bullet) { + public void behaveUpdate(EntityBulletBaseNT bullet) { if(bullet.worldObj.isRemote) return; @@ -469,16 +468,16 @@ public class GunFatmanFactory { for(int i = 0; i < 24; i++) { - EntityBulletBase nuke = null; + EntityBulletBaseNT nuke = null; if(i < 6) - nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_LOW); + nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_LOW); else if(i < 12) - nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_TOTS); + nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_TOTS); else if(i < 18) - nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_NORMAL); + nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_NORMAL); else - nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_AMAT); + nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_AMAT); nuke.setPosition(bullet.posX, bullet.posY, bullet.posZ); @@ -503,8 +502,8 @@ public class GunFatmanFactory { bullet.ammo = new ComparableStack(ModItems.ammo_nuke.stackFromEnum(AmmoFatman.BALEFIRE)); bullet.style = BulletConfiguration.STYLE_BF; - bullet.bImpact = new IBulletImpactBehavior() { - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + bullet.bntImpact = new IBulletImpactBehaviorNT() { + public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) { if(!bullet.worldObj.isRemote) { diff --git a/src/main/java/com/hbm/handler/guncfg/GunGrenadeFactory.java b/src/main/java/com/hbm/handler/guncfg/GunGrenadeFactory.java index 0c787f9a9..d65f964e9 100644 --- a/src/main/java/com/hbm/handler/guncfg/GunGrenadeFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/GunGrenadeFactory.java @@ -2,13 +2,11 @@ package com.hbm.handler.guncfg; import java.util.ArrayList; -import com.hbm.entity.projectile.EntityBulletBase; import com.hbm.explosion.ExplosionNukeSmall; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; import com.hbm.handler.CasingEjector; import com.hbm.handler.GunConfiguration; -import com.hbm.interfaces.IBulletImpactBehavior; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.items.ModItems; import com.hbm.items.ItemAmmoEnums.AmmoGrenade; @@ -131,7 +129,7 @@ public class GunGrenadeFactory { bullet.trail = 0; bullet.incendiary = 2; - bullet.bImpact = BulletConfigFactory.getPhosphorousEffect(10, 60 * 20, 100, 0.5D, 1F); + bullet.bntImpact = BulletConfigFactory.getPhosphorousEffect(10, 60 * 20, 100, 0.5D, 1F); bullet.spentCasing = CASING40MM.clone().register("40MMPhos"); @@ -213,12 +211,8 @@ public class GunGrenadeFactory { bullet.velocity = 4; bullet.explosive = 0.0F; - bullet.bImpact = new IBulletImpactBehavior() { - - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_TOTS); - } + bullet.bntImpact = (bulletnt, x, y, z) -> { + BulletConfigFactory.nuclearExplosion(bulletnt, x, y, z, ExplosionNukeSmall.PARAMS_TOTS); }; bullet.spentCasing = CASING40MM.clone().register("40MMNuke"); diff --git a/src/main/java/com/hbm/handler/guncfg/GunNPCFactory.java b/src/main/java/com/hbm/handler/guncfg/GunNPCFactory.java index 960ebee81..8a6bffe40 100644 --- a/src/main/java/com/hbm/handler/guncfg/GunNPCFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/GunNPCFactory.java @@ -3,12 +3,11 @@ package com.hbm.handler.guncfg; import java.util.List; import java.util.Random; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; +import com.hbm.entity.projectile.EntityBulletBaseNT.IBulletUpdateBehaviorNT; import com.hbm.explosion.ExplosionNukeGeneric; 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; @@ -51,30 +50,26 @@ public class GunNPCFactory { bullet.trail = 1; bullet.explosive = 1.5F; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = (bulletnt) -> { + + if(bulletnt.worldObj.isRemote) + return; - @Override - public void behaveUpdate(EntityBulletBase bullet) { - - if(bullet.worldObj.isRemote) - return; - - if(bullet.ticksExisted % 10 != 5) - return; - - List players = bullet.worldObj.getEntitiesWithinAABB(EntityPlayer.class, bullet.boundingBox.expand(50, 50, 50)); - - for(EntityPlayer player : players) { - - Vec3 motion = Vec3.createVectorHelper(player.posX - bullet.posX, (player.posY + player.getEyeHeight()) - bullet.posY, player.posZ - bullet.posZ); - motion = motion.normalize(); - - EntityBulletBase bolt = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_BOLT); - bolt.shooter = bullet.shooter; - bolt.setPosition(bullet.posX, bullet.posY, bullet.posZ); - bolt.setThrowableHeading(motion.xCoord, motion.yCoord, motion.zCoord, 0.5F, 0.05F); - bullet.worldObj.spawnEntityInWorld(bolt); - } + if(bulletnt.ticksExisted % 10 != 5) + return; + + List players = bulletnt.worldObj.getEntitiesWithinAABB(EntityPlayer.class, bulletnt.boundingBox.expand(50, 50, 50)); + + for(EntityPlayer player : players) { + + Vec3 motion = Vec3.createVectorHelper(player.posX - bulletnt.posX, (player.posY + player.getEyeHeight()) - bulletnt.posY, player.posZ - bulletnt.posZ); + motion = motion.normalize(); + + EntityBulletBaseNT bolt = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_BOLT); + bolt.setThrower(bulletnt.getThrower()); + bolt.setPosition(bulletnt.posX, bulletnt.posY, bulletnt.posZ); + bolt.setThrowableHeading(motion.xCoord, motion.yCoord, motion.zCoord, 0.5F, 0.05F); + bulletnt.worldObj.spawnEntityInWorld(bolt); } }; @@ -129,20 +124,16 @@ public class GunNPCFactory { bullet.vPFX = "reddust"; bullet.damageType = ModDamageSource.s_laser; - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = (bulletnt, x, y, z) -> { + + if(bulletnt.worldObj.isRemote) + return; - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - - if(bullet.worldObj.isRemote) - return; - - EntityBulletBase meteor = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR); - meteor.setPosition(bullet.posX, bullet.posY + 30 + meteor.worldObj.rand.nextInt(10), bullet.posZ); - meteor.motionY = -1D; - meteor.shooter = bullet.shooter; - bullet.worldObj.spawnEntityInWorld(meteor); - } + EntityBulletBaseNT meteor = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR); + meteor.setPosition(bulletnt.posX, bulletnt.posY + 30 + meteor.worldObj.rand.nextInt(10), bulletnt.posZ); + meteor.motionY = -1D; + meteor.setThrower(bulletnt.getThrower()); + bulletnt.worldObj.spawnEntityInWorld(meteor); }; return bullet; @@ -178,25 +169,21 @@ public class GunNPCFactory { bullet.explosive = 2.5F; bullet.style = BulletConfiguration.STYLE_METEOR; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = (bulletnt) -> { - @Override - public void behaveUpdate(EntityBulletBase bullet) { - - if(!bullet.worldObj.isRemote) - return; - - Random rand = bullet.worldObj.rand; - - for(int i = 0; i < 5; i++) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setString("type", "vanillaExt"); - nbt.setString("mode", "flame"); - nbt.setDouble("posX", bullet.posX + rand.nextDouble() * 0.5 - 0.25); - nbt.setDouble("posY", bullet.posY + rand.nextDouble() * 0.5 - 0.25); - nbt.setDouble("posZ", bullet.posZ + rand.nextDouble() * 0.5 - 0.25); - MainRegistry.proxy.effectNT(nbt); - } + if(!bulletnt.worldObj.isRemote) + return; + + Random rand = bulletnt.worldObj.rand; + + for(int i = 0; i < 5; i++) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setString("type", "vanillaExt"); + nbt.setString("mode", "flame"); + nbt.setDouble("posX", bulletnt.posX + rand.nextDouble() * 0.5 - 0.25); + nbt.setDouble("posY", bulletnt.posY + rand.nextDouble() * 0.5 - 0.25); + nbt.setDouble("posZ", bulletnt.posZ + rand.nextDouble() * 0.5 - 0.25); + MainRegistry.proxy.effectNT(nbt); } }; @@ -245,13 +232,13 @@ public class GunNPCFactory { bullet.destroysBlocks = false; bullet.explosive = 0F; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = new IBulletUpdateBehaviorNT() { double angle = 90; double range = 100; @Override - public void behaveUpdate(EntityBulletBase bullet) { + public void behaveUpdate(EntityBulletBaseNT bullet) { if(bullet.worldObj.isRemote) return; @@ -265,7 +252,7 @@ public class GunNPCFactory { if(target != null) { if(bullet.getDistanceSqToEntity(target) < 5) { - bullet.getConfig().bImpact.behaveBlockHit(bullet, -1, -1, -1); + bullet.getConfig().bntImpact.behaveBlockHit(bullet, -1, -1, -1); bullet.setDead(); return; } @@ -281,7 +268,7 @@ public class GunNPCFactory { } } - private void chooseTarget(EntityBulletBase bullet) { + private void chooseTarget(EntityBulletBaseNT bullet) { List entities = bullet.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bullet.boundingBox.expand(range, range, range)); @@ -292,7 +279,7 @@ public class GunNPCFactory { for(EntityLivingBase e : entities) { - if(!e.isEntityAlive() || e == bullet.shooter) + if(!e.isEntityAlive() || e == bullet.getThrower()) continue; Vec3 delta = Vec3.createVectorHelper(e.posX - bullet.posX, e.posY + e.height / 2 - bullet.posY, e.posZ - bullet.posZ); @@ -319,27 +306,23 @@ public class GunNPCFactory { } }; - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = (bulletnt, x, y, z) -> { - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { + bulletnt.worldObj.playSoundEffect(bulletnt.posX, bulletnt.posY, bulletnt.posZ, "hbm:entity.ufoBlast", 5.0F, 0.9F + bulletnt.worldObj.rand.nextFloat() * 0.2F); + bulletnt.worldObj.playSoundEffect(bulletnt.posX, bulletnt.posY, bulletnt.posZ, "fireworks.blast", 5.0F, 0.5F); + ExplosionNukeGeneric.dealDamage(bulletnt.worldObj, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 10, 50); - bullet.worldObj.playSoundEffect(bullet.posX, bullet.posY, bullet.posZ, "hbm:entity.ufoBlast", 5.0F, 0.9F + bullet.worldObj.rand.nextFloat() * 0.2F); - bullet.worldObj.playSoundEffect(bullet.posX, bullet.posY, bullet.posZ, "fireworks.blast", 5.0F, 0.5F); - ExplosionNukeGeneric.dealDamage(bullet.worldObj, bullet.posX, bullet.posY, bullet.posZ, 10, 50); - - for(int i = 0; i < 3; i++) { - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", "plasmablast"); - data.setFloat("r", 0.0F); - data.setFloat("g", 0.75F); - data.setFloat("b", 1.0F); - data.setFloat("pitch", -30F + 30F * i); - data.setFloat("yaw", bullet.worldObj.rand.nextFloat() * 180F); - data.setFloat("scale", 5F); - PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), - new TargetPoint(bullet.worldObj.provider.dimensionId, bullet.posX, bullet.posY, bullet.posZ, 100)); - } + for(int i = 0; i < 3; i++) { + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "plasmablast"); + data.setFloat("r", 0.0F); + data.setFloat("g", 0.75F); + data.setFloat("b", 1.0F); + data.setFloat("pitch", -30F + 30F * i); + data.setFloat("yaw", bulletnt.worldObj.rand.nextFloat() * 180F); + data.setFloat("scale", 5F); + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ), + new TargetPoint(bulletnt.worldObj.provider.dimensionId, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 100)); } }; diff --git a/src/main/java/com/hbm/handler/guncfg/GunOSIPRFactory.java b/src/main/java/com/hbm/handler/guncfg/GunOSIPRFactory.java index db093f702..720a57e2c 100644 --- a/src/main/java/com/hbm/handler/guncfg/GunOSIPRFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/GunOSIPRFactory.java @@ -101,17 +101,17 @@ public class GunOSIPRFactory { bullet.maxAge = 150; bullet.velocity = 2; - bullet.bHurt = (ball, entity) -> { + bullet.bntHurt = (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) + if(entity == ball.getThrower()) return; if(entityLiving.getHealth() <= 1000) { entityLiving.addPotionEffect(new PotionEffect(HbmPotion.bang.id, 1, 0)); - entityLiving.setLastAttacker(ball.shooter); + entityLiving.setLastAttacker(ball.getThrower()); } else if(entityLiving.getHealth() > 1000) { ball.setDead(); return; @@ -120,14 +120,14 @@ public class GunOSIPRFactory { } }; - bullet.bRicochet = (ball, x, y, z) -> { + bullet.bntRicochet = (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) -> { + bullet.bntImpact = (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); diff --git a/src/main/java/com/hbm/handler/guncfg/GunRocketFactory.java b/src/main/java/com/hbm/handler/guncfg/GunRocketFactory.java index 8af201e52..cea0490c3 100644 --- a/src/main/java/com/hbm/handler/guncfg/GunRocketFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/GunRocketFactory.java @@ -3,14 +3,11 @@ package com.hbm.handler.guncfg; import java.util.ArrayList; import com.hbm.entity.effect.EntitySpear; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.explosion.ExplosionNukeSmall; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; 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.items.ItemAmmoEnums.AmmoRocket; @@ -287,12 +284,8 @@ public class GunRocketFactory { bullet.incendiary = 0; bullet.trail = 7; - bullet.bImpact = new IBulletImpactBehavior() { - - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_MEDIUM); - } + bullet.bntImpact = (bulletnt, x, y, z) -> { + BulletConfigFactory.nuclearExplosion(bulletnt, x, y, z, ExplosionNukeSmall.PARAMS_MEDIUM); }; return bullet; @@ -331,18 +324,14 @@ public class GunRocketFactory { bullet.LBRC = 100; bullet.doesPenetrate = true; - bullet.bRicochet = new IBulletRicochetBehavior() { + bullet.bntRicochet = (bulletnt, bX, bY, bZ) -> { + World worldObj = bulletnt.worldObj; + if(!worldObj.isRemote && (worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.wood || + worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.plants || + worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.glass || + worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.leaves)) + worldObj.func_147480_a(bX, bY, bZ, false); - @Override - public void behaveBlockRicochet(EntityBulletBase bullet, int bX, int bY, int bZ) { - World worldObj = bullet.worldObj; - if(!worldObj.isRemote && - (worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.wood || - worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.plants || - worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.glass || - worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.leaves)) - worldObj.func_147480_a(bX, bY, bZ, false);} - }; return bullet; @@ -360,7 +349,7 @@ public class GunRocketFactory { bullet.incendiary = 5; bullet.trail = 9; - bullet.bImpact = BulletConfigFactory.getPhosphorousEffect(10, 60 * 20, 100, 0.5D, 1F); + bullet.bntImpact = BulletConfigFactory.getPhosphorousEffect(10, 60 * 20, 100, 0.5D, 1F); return bullet; } @@ -375,23 +364,16 @@ public class GunRocketFactory { bullet.explosive = 2F; bullet.trail = 0; - bullet.bUpdate = new IBulletUpdateBehavior() { - - @Override - public void behaveUpdate(EntityBulletBase bullet) { - - if(!bullet.worldObj.isRemote) { - - if(bullet.ticksExisted > 10) { - bullet.setDead(); - - for(int i = 0; i < 50; i++) { - - EntityBulletBase bolt = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.M44_AP); - bolt.setPosition(bullet.posX, bullet.posY, bullet.posZ); - bolt.setThrowableHeading(bullet.motionX, bullet.motionY, bullet.motionZ, 0.25F, 0.1F); - bullet.worldObj.spawnEntityInWorld(bolt); - } + bullet.bntUpdate = (bulletnt) -> { + if(!bulletnt.worldObj.isRemote) { + if(bulletnt.ticksExisted > 10) { + bulletnt.setDead(); + for(int i = 0; i < 50; i++) { + EntityBulletBaseNT bolt = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.M44_AP); + bolt.setPosition(bulletnt.posX, bulletnt.posY, bulletnt.posZ); + bolt.setThrowableHeading(bulletnt.motionX, bulletnt.motionY, bulletnt.motionZ, 0.25F, 0.1F); + bolt.setThrower(bulletnt.getThrower()); + bulletnt.worldObj.spawnEntityInWorld(bolt); } } } @@ -413,21 +395,17 @@ public class GunRocketFactory { bullet.incendiary = 0; bullet.trail = 7; - bullet.bImpact = new IBulletImpactBehavior() { + bullet.bntImpact = (bulletnt, x, y, z) -> { - @Override - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) { - - if(bullet.worldObj.isRemote) - return; - - EntitySpear spear = new EntitySpear(bullet.worldObj); - spear.posX = bullet.posX; - spear.posZ = bullet.posZ; - spear.posY = bullet.posY + 100; - - bullet.worldObj.spawnEntityInWorld(spear); - } + if(bulletnt.worldObj.isRemote) + return; + + EntitySpear spear = new EntitySpear(bulletnt.worldObj); + spear.posX = bulletnt.posX; + spear.posZ = bulletnt.posZ; + spear.posY = bulletnt.posY + 100; + + bulletnt.worldObj.spawnEntityInWorld(spear); }; return bullet; diff --git a/src/main/java/com/hbm/handler/guncfg/GunRocketHomingFactory.java b/src/main/java/com/hbm/handler/guncfg/GunRocketHomingFactory.java index 9ace3b45f..3e2808d40 100644 --- a/src/main/java/com/hbm/handler/guncfg/GunRocketHomingFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/GunRocketHomingFactory.java @@ -2,12 +2,10 @@ package com.hbm.handler.guncfg; import java.util.ArrayList; -import com.hbm.entity.projectile.EntityBulletBase; 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.ItemAmmoEnums.AmmoStinger; import com.hbm.items.ModItems; @@ -98,28 +96,24 @@ GunConfiguration config = new GunConfiguration(); bullet.explosive = 4F; bullet.trail = 0; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = (bulletnt) -> { - @Override - public void behaveUpdate(EntityBulletBase bullet) { - - if(!bullet.worldObj.isRemote) { - - EntityPlayer player = bullet.worldObj.getClosestPlayerToEntity(bullet, -1.0D); - EntityRocketHoming rocket = new EntityRocketHoming(bullet.worldObj, player, 1.0F, 5.0F, 0); - if(player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) { - EntityRocketHoming rocket2 = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 0); - rocket = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 0); - rocket.setIsCritical(true); - rocket2.setIsCritical(true); - bullet.worldObj.spawnEntityInWorld(rocket2); - } - rocket.homingMod = 5; - rocket.homingRadius = 25; - bullet.worldObj.spawnEntityInWorld(rocket); - bullet.setDead(); + if(!bulletnt.worldObj.isRemote) { + EntityPlayer player = bulletnt.worldObj.getClosestPlayerToEntity(bulletnt, -1.0D); + EntityRocketHoming rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.0F, 5.0F, 0); + if(player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) { + EntityRocketHoming rocket2 = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 0); + rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 0); + rocket.setIsCritical(true); + rocket2.setIsCritical(true); + bulletnt.worldObj.spawnEntityInWorld(rocket2); } + rocket.homingMod = 5; + rocket.homingRadius = 25; + bulletnt.worldObj.spawnEntityInWorld(rocket); + bulletnt.setDead(); + } }; return bullet; @@ -135,28 +129,24 @@ GunConfiguration config = new GunConfiguration(); bullet.trail = 0; bullet.wear = 15; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = (bulletnt) -> { - @Override - public void behaveUpdate(EntityBulletBase bullet) { - - if(!bullet.worldObj.isRemote) { - - EntityPlayer player = bullet.worldObj.getClosestPlayerToEntity(bullet, -1.0D); - EntityRocketHoming rocket = new EntityRocketHoming(bullet.worldObj, player, 1.0F, 5.0F, 1); - if(player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) { - EntityRocketHoming rocket2 = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 1); - rocket = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 1); - rocket.setIsCritical(true); - rocket2.setIsCritical(true); - bullet.worldObj.spawnEntityInWorld(rocket2); - } - rocket.homingMod = 5; - rocket.homingRadius = 25; - bullet.worldObj.spawnEntityInWorld(rocket); - bullet.setDead(); + if(!bulletnt.worldObj.isRemote) { + EntityPlayer player = bulletnt.worldObj.getClosestPlayerToEntity(bulletnt, -1.0D); + EntityRocketHoming rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.0F, 5.0F, 1); + if(player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) { + EntityRocketHoming rocket2 = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 1); + rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 1); + rocket.setIsCritical(true); + rocket2.setIsCritical(true); + bulletnt.worldObj.spawnEntityInWorld(rocket2); } + rocket.homingMod = 5; + rocket.homingRadius = 25; + bulletnt.worldObj.spawnEntityInWorld(rocket); + bulletnt.setDead(); + } }; return bullet; @@ -172,28 +162,24 @@ GunConfiguration config = new GunConfiguration(); bullet.trail = 0; bullet.wear = 12; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = (bulletnt) -> { - @Override - public void behaveUpdate(EntityBulletBase bullet) { - - if(!bullet.worldObj.isRemote) { - - EntityPlayer player = bullet.worldObj.getClosestPlayerToEntity(bullet, -1.0D); - EntityRocketHoming rocket = new EntityRocketHoming(bullet.worldObj, player, 1.0F, 5.0F, 2); - if(player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) { - EntityRocketHoming rocket2 = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 2); - rocket = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 2); - rocket.setIsCritical(true); - rocket2.setIsCritical(true); - bullet.worldObj.spawnEntityInWorld(rocket2); - } - rocket.homingMod = 5; - rocket.homingRadius = 25; - bullet.worldObj.spawnEntityInWorld(rocket); - bullet.setDead(); + if(!bulletnt.worldObj.isRemote) { + EntityPlayer player = bulletnt.worldObj.getClosestPlayerToEntity(bulletnt, -1.0D); + EntityRocketHoming rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.0F, 5.0F, 2); + if(player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) { + EntityRocketHoming rocket2 = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 2); + rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 2); + rocket.setIsCritical(true); + rocket2.setIsCritical(true); + bulletnt.worldObj.spawnEntityInWorld(rocket2); } + rocket.homingMod = 5; + rocket.homingRadius = 25; + bulletnt.worldObj.spawnEntityInWorld(rocket); + bulletnt.setDead(); + } }; return bullet; @@ -209,31 +195,27 @@ GunConfiguration config = new GunConfiguration(); bullet.trail = 0; bullet.wear = 30; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = (bulletnt) -> { - @Override - public void behaveUpdate(EntityBulletBase bullet) { + if(!bulletnt.worldObj.isRemote) { - if(!bullet.worldObj.isRemote) { + EntityPlayer player = bulletnt.worldObj.getClosestPlayerToEntity(bulletnt, -1.0D); - EntityPlayer player = bullet.worldObj.getClosestPlayerToEntity(bullet, -1.0D); - - if(player.getDistanceToEntity(bullet) < 16) { - EntityRocketHoming rocket = new EntityRocketHoming(bullet.worldObj, player, 1.0F, 5.0F, 4); - if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) { - EntityRocketHoming rocket2 = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 4); - rocket = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 4); - rocket.setIsCritical(true); - rocket2.setIsCritical(true); - bullet.worldObj.spawnEntityInWorld(rocket2); - } - rocket.homingMod = 5; - rocket.homingRadius = 25; - bullet.worldObj.spawnEntityInWorld(rocket); + if(player.getDistanceToEntity(bulletnt) < 16) { + EntityRocketHoming rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.0F, 5.0F, 4); + if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) { + EntityRocketHoming rocket2 = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 4); + rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 4); + rocket.setIsCritical(true); + rocket2.setIsCritical(true); + bulletnt.worldObj.spawnEntityInWorld(rocket2); } - bullet.setDead(); - + rocket.homingMod = 5; + rocket.homingRadius = 25; + bulletnt.worldObj.spawnEntityInWorld(rocket); } + bulletnt.setDead(); + } }; return bullet; @@ -248,31 +230,27 @@ GunConfiguration config = new GunConfiguration(); bullet.explosive = 8F; bullet.trail = 0; - bullet.bUpdate = new IBulletUpdateBehavior() { + bullet.bntUpdate = (bulletnt) -> { - @Override - public void behaveUpdate(EntityBulletBase bullet) { + if(!bulletnt.worldObj.isRemote) { - if(!bullet.worldObj.isRemote) { + EntityPlayer player = bulletnt.worldObj.getClosestPlayerToEntity(bulletnt, -1.0D); - EntityPlayer player = bullet.worldObj.getClosestPlayerToEntity(bullet, -1.0D); - - if(player.getDistanceToEntity(bullet) < 16) { - EntityRocketHoming rocket = new EntityRocketHoming(bullet.worldObj, player, 1.0F, 5.0F, 42); - if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) { - EntityRocketHoming rocket2 = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 42); - rocket = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 42); - rocket.setIsCritical(true); - rocket2.setIsCritical(true); - bullet.worldObj.spawnEntityInWorld(rocket2); - } - rocket.homingMod = 5; - rocket.homingRadius = 25; - bullet.worldObj.spawnEntityInWorld(rocket); + if(player.getDistanceToEntity(bulletnt) < 16) { + EntityRocketHoming rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.0F, 5.0F, 42); + if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) { + EntityRocketHoming rocket2 = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 42); + rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 42); + rocket.setIsCritical(true); + rocket2.setIsCritical(true); + bulletnt.worldObj.spawnEntityInWorld(rocket2); } - bullet.setDead(); - + rocket.homingMod = 5; + rocket.homingRadius = 25; + bulletnt.worldObj.spawnEntityInWorld(rocket); } + bulletnt.setDead(); + } }; return bullet; diff --git a/src/main/java/com/hbm/interfaces/IBulletHitBehavior.java b/src/main/java/com/hbm/interfaces/IBulletHitBehavior.java deleted file mode 100644 index b07aab829..000000000 --- a/src/main/java/com/hbm/interfaces/IBulletHitBehavior.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.hbm.interfaces; - -import com.hbm.entity.projectile.EntityBulletBase; - -import net.minecraft.entity.Entity; - -public interface IBulletHitBehavior { - - //entity is hit, bullet dies - public void behaveEntityHit(EntityBulletBase bullet, Entity hit); - -} diff --git a/src/main/java/com/hbm/interfaces/IBulletHurtBehavior.java b/src/main/java/com/hbm/interfaces/IBulletHurtBehavior.java deleted file mode 100644 index 4aa57a5a2..000000000 --- a/src/main/java/com/hbm/interfaces/IBulletHurtBehavior.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.hbm.interfaces; - -import com.hbm.entity.projectile.EntityBulletBase; - -import net.minecraft.entity.Entity; - -public interface IBulletHurtBehavior { - - //entity is hit - public void behaveEntityHurt(EntityBulletBase bullet, Entity hit); -} diff --git a/src/main/java/com/hbm/interfaces/IBulletImpactBehavior.java b/src/main/java/com/hbm/interfaces/IBulletImpactBehavior.java deleted file mode 100644 index 30c067d79..000000000 --- a/src/main/java/com/hbm/interfaces/IBulletImpactBehavior.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.hbm.interfaces; - -import com.hbm.entity.projectile.EntityBulletBase; - -public interface IBulletImpactBehavior { - - //block is hit, bullet dies - //also called when an entity is hit but with -1 coords, so beware - public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z); - -} diff --git a/src/main/java/com/hbm/interfaces/IBulletRicochetBehavior.java b/src/main/java/com/hbm/interfaces/IBulletRicochetBehavior.java deleted file mode 100644 index 4f4f5c5f6..000000000 --- a/src/main/java/com/hbm/interfaces/IBulletRicochetBehavior.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.hbm.interfaces; - -import com.hbm.entity.projectile.EntityBulletBase; - -public interface IBulletRicochetBehavior { - - //block is hit, bullet ricochets - public void behaveBlockRicochet(EntityBulletBase bullet, int x, int y, int z); - -} diff --git a/src/main/java/com/hbm/interfaces/IBulletUpdateBehavior.java b/src/main/java/com/hbm/interfaces/IBulletUpdateBehavior.java deleted file mode 100644 index 9f614c41e..000000000 --- a/src/main/java/com/hbm/interfaces/IBulletUpdateBehavior.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.hbm.interfaces; - -import com.hbm.entity.projectile.EntityBulletBase; - -public interface IBulletUpdateBehavior { - - //once every update, for lcokon, steering and other memes - public void behaveUpdate(EntityBulletBase bullet); - -} diff --git a/src/main/java/com/hbm/inventory/container/ContainerCrateIron.java b/src/main/java/com/hbm/inventory/container/ContainerCrateIron.java index d91eb1be0..26bdada96 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerCrateIron.java +++ b/src/main/java/com/hbm/inventory/container/ContainerCrateIron.java @@ -10,25 +10,20 @@ public class ContainerCrateIron extends ContainerCrateBase { public ContainerCrateIron(InventoryPlayer invPlayer, TileEntityCrateIron tedf) { super(tedf); - - for(int i = 0; i < 4; i++) - { - for(int j = 0; j < 9; j++) - { + + for(int i = 0; i < 4; i++) { + for(int j = 0; j < 9; j++) { this.addSlotToContainer(new Slot(tedf, j + i * 9, 8 + j * 18, 18 + i * 18)); } } - - for(int i = 0; i < 3; i++) - { - for(int j = 0; j < 9; j++) - { + + for(int i = 0; i < 3; i++) { + for(int j = 0; j < 9; j++) { this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 20)); } } - - for(int i = 0; i < 9; i++) - { + + for(int i = 0; i < 9; i++) { this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 20)); } } diff --git a/src/main/java/com/hbm/inventory/container/ContainerCrateTemplate.java b/src/main/java/com/hbm/inventory/container/ContainerCrateTemplate.java new file mode 100644 index 000000000..122c301e4 --- /dev/null +++ b/src/main/java/com/hbm/inventory/container/ContainerCrateTemplate.java @@ -0,0 +1,29 @@ +package com.hbm.inventory.container; + +import com.hbm.tileentity.machine.storage.TileEntityCrateTemplate; + +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; + +public class ContainerCrateTemplate extends ContainerCrateBase { + + public ContainerCrateTemplate(InventoryPlayer invPlayer, TileEntityCrateTemplate tedf) { + super(tedf); + + for(int i = 0; i < 3; i++) { + for(int j = 0; j < 9; j++) { + this.addSlotToContainer(new Slot(tedf, j + i * 9, 8 + j * 18, 18 + i * 18)); + } + } + + for(int i = 0; i < 3; i++) { + for(int j = 0; j < 9; j++) { + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 86 + i * 18)); + } + } + + for(int i = 0; i < 9; i++) { + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 144)); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java index 5c5effbf5..dc628427a 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java +++ b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java @@ -5,13 +5,11 @@ import java.util.List; import org.lwjgl.opengl.GL11; -import com.hbm.items.special.ItemBookLore.*; import com.hbm.lib.RefStrings; import com.hbm.util.I18nUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; diff --git a/src/main/java/com/hbm/inventory/gui/GUICrateTemplate.java b/src/main/java/com/hbm/inventory/gui/GUICrateTemplate.java new file mode 100644 index 000000000..9968d461c --- /dev/null +++ b/src/main/java/com/hbm/inventory/gui/GUICrateTemplate.java @@ -0,0 +1,42 @@ +package com.hbm.inventory.gui; + +import org.lwjgl.opengl.GL11; + +import com.hbm.inventory.container.ContainerCrateTemplate; +import com.hbm.lib.RefStrings; +import com.hbm.tileentity.machine.storage.TileEntityCrateTemplate; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +public class GUICrateTemplate extends GuiContainer { + + private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_crate_template.png"); + private TileEntityCrateTemplate diFurnace; + + public GUICrateTemplate(InventoryPlayer invPlayer, TileEntityCrateTemplate tedf) { + super(new ContainerCrateTemplate(invPlayer, tedf)); + diFurnace = tedf; + + this.xSize = 176; + this.ySize = 168; + } + + @Override + protected void drawGuiContainerForegroundLayer(int i, int j) { + String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName()); + + this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + } +} \ No newline at end of file diff --git a/src/main/java/com/hbm/inventory/gui/GUIMachineAssembler.java b/src/main/java/com/hbm/inventory/gui/GUIMachineAssembler.java index 145174fad..31ebd23ec 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIMachineAssembler.java +++ b/src/main/java/com/hbm/inventory/gui/GUIMachineAssembler.java @@ -30,7 +30,7 @@ public class GUIMachineAssembler extends GuiInfoContainer { public void drawScreen(int mouseX, int mouseY, float f) { super.drawScreen(mouseX, mouseY, f); - this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 70 - 52, 16, 52, assembler.power, assembler.maxPower); + this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 70 - 52, 16, 52, assembler.power, assembler.getMaxPower()); if(assembler.getStackInSlot(4) == null || assembler.getStackInSlot(4).getItem()!= ModItems.assembly_template) { @@ -63,14 +63,15 @@ public class GUIMachineAssembler extends GuiInfoContainer { Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - int i = (int)assembler.getPowerScaled(52); + int i = (int) (assembler.power * 52 / assembler.getMaxPower()); drawTexturedModalRect(guiLeft + 116, guiTop + 70 - i, 176, 52 - i, 16, i); - int j = assembler.getProgressScaled(83); - drawTexturedModalRect(guiLeft + 45, guiTop + 82, 2, 222, j, 32); + if(assembler.isProgressing) { + int j = assembler.progress[0] * 83 / assembler.maxProgress[0]; + drawTexturedModalRect(guiLeft + 45, guiTop + 82, 2, 222, j, 32); + } if(assembler.getStackInSlot(4) == null || assembler.getStackInSlot(4).getItem()!= ModItems.assembly_template) { - this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 6); } diff --git a/src/main/java/com/hbm/items/ItemAmmoEnums.java b/src/main/java/com/hbm/items/ItemAmmoEnums.java index d42eb4015..8ef0638d7 100644 --- a/src/main/java/com/hbm/items/ItemAmmoEnums.java +++ b/src/main/java/com/hbm/items/ItemAmmoEnums.java @@ -748,6 +748,23 @@ public class ItemAmmoEnums { } } + public enum AmmoCoilgun implements IAmmoItemEnum { + STOCK("ammo_coilgun"), + DU("ammo_coilgun_du", AmmoItemTrait.PRO_HEAVY_DAMAGE, AmmoItemTrait.CON_HEAVY_WEAR), + RUBBER("ammo_coilgun_rubber", AmmoItemTrait.NEU_MORE_BOUNCY, AmmoItemTrait.CON_DAMAGE); + + private final Set traits; + private final String unloc; + + private AmmoCoilgun(String unloc, AmmoItemTrait... traits) { + this.traits = safeAssign(traits); + this.unloc = unloc; + } + + @Override public Set getTraits() { return traits; } + @Override public String getInternalName() { return unloc; } + } + public interface IAmmoItemEnum { public Set getTraits(); public String getInternalName(); diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 50a667323..91c4863de 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -1506,6 +1506,7 @@ public class ModItems { public static ItemEnumMulti ammo_dart; public static ItemEnumMulti ammo_stinger_rocket; public static ItemEnumMulti ammo_luna_sniper; + public static ItemEnumMulti ammo_coilgun; public static Item ammo_cell; @@ -1574,7 +1575,6 @@ public class ModItems { public static Item gun_b92_ammo; public static Item gun_b93; public static Item gun_coilgun; - public static Item gun_coilgun_ammo; public static Item gun_xvl1456; public static Item gun_xvl1456_ammo; public static Item gun_osipr; @@ -4135,6 +4135,7 @@ public class ModItems { ammo_fuel = new ItemAmmo(AmmoFlamethrower.class).setUnlocalizedName("ammo_fuel"); ammo_fireext = new ItemAmmo(AmmoFireExt.class).setUnlocalizedName("ammo_fireext"); ammo_cell = new ItemCustomLore().setCreativeTab(MainRegistry.weaponTab).setUnlocalizedName("ammo_cell").setMaxStackSize(16); + ammo_coilgun = new ItemAmmo(AmmoCoilgun.class).setUnlocalizedName("ammo_coilgun"); ammo_dart = (ItemEnumMulti) new ItemAmmo(AmmoDart.class).setUnlocalizedName("ammo_dart").setMaxStackSize(16); ammo_stinger_rocket = new ItemAmmo(AmmoStinger.class).setUnlocalizedName("ammo_stinger_rocket"); ammo_luna_sniper = new ItemAmmo(AmmoLunaticSniper.class).setUnlocalizedName("ammo_luna_sniper"); @@ -4202,7 +4203,6 @@ public class ModItems { gun_b92_ammo = new GunB92Cell().setUnlocalizedName("gun_b92_ammo").setMaxStackSize(1).setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_b92_ammo_alt"); gun_b92 = new GunB92().setUnlocalizedName("gun_b92").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_b92"); gun_b93 = new GunB93().setUnlocalizedName("gun_b93").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_b93"); - gun_coilgun_ammo = new Item().setUnlocalizedName("gun_coilgun_ammo").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_coilgun_ammo"); gun_coilgun = new ItemCoilgun(GunEnergyFactory.getCoilgunConfig()).setUnlocalizedName("gun_coilgun").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_coilgun"); gun_xvl1456_ammo = new Item().setUnlocalizedName("gun_xvl1456_ammo").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_xvl1456_ammo"); gun_xvl1456 = new ItemGunGauss(GunGaussFactory.getXVLConfig(), GunGaussFactory.getChargedConfig()).setUnlocalizedName("gun_xvl1456").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_xvl1456"); @@ -7083,7 +7083,6 @@ public class ModItems { //GameRegistry.registerItem(gun_uboinik_ammo, gun_uboinik_ammo.getUnlocalizedName()); //GameRegistry.registerItem(gun_lever_action_ammo, gun_lever_action_ammo.getUnlocalizedName()); //GameRegistry.registerItem(gun_bolt_action_ammo, gun_bolt_action_ammo.getUnlocalizedName()); - GameRegistry.registerItem(gun_coilgun_ammo, gun_coilgun_ammo.getUnlocalizedName()); GameRegistry.registerItem(gun_xvl1456_ammo, gun_xvl1456_ammo.getUnlocalizedName()); GameRegistry.registerItem(gun_osipr_ammo, gun_osipr_ammo.getUnlocalizedName()); GameRegistry.registerItem(gun_osipr_ammo2, gun_osipr_ammo2.getUnlocalizedName()); @@ -7118,6 +7117,7 @@ public class ModItems { GameRegistry.registerItem(ammo_rocket, ammo_rocket.getUnlocalizedName()); GameRegistry.registerItem(ammo_stinger_rocket, ammo_stinger_rocket.getUnlocalizedName()); GameRegistry.registerItem(ammo_luna_sniper, ammo_luna_sniper.getUnlocalizedName()); + GameRegistry.registerItem(ammo_coilgun, ammo_coilgun.getUnlocalizedName()); GameRegistry.registerItem(ammo_grenade, ammo_grenade.getUnlocalizedName()); GameRegistry.registerItem(ammo_shell, ammo_shell.getUnlocalizedName()); @@ -8161,6 +8161,8 @@ public class ModItems { addRemap("gas_petroleum", gas_full, Fluids.PETROLEUM.getID()); addRemap("gas_biogas", gas_full, Fluids.BIOGAS.getID()); addRemap("gas_lpg", gas_full, Fluids.LPG.getID()); + + addRemap("gun_coilgun_ammo", ammo_coilgun, AmmoCoilgun.STOCK); } public static void addRemap(String unloc, Item item, Enum sub) { diff --git a/src/main/java/com/hbm/items/special/ItemBookLore.java b/src/main/java/com/hbm/items/special/ItemBookLore.java index 6fe393616..866bd0866 100644 --- a/src/main/java/com/hbm/items/special/ItemBookLore.java +++ b/src/main/java/com/hbm/items/special/ItemBookLore.java @@ -2,8 +2,6 @@ package com.hbm.items.special; import java.util.List; -import org.apache.commons.lang3.math.NumberUtils; - import com.hbm.inventory.gui.GUIBookLore; import com.hbm.items.ModItems; import com.hbm.lib.RefStrings; diff --git a/src/main/java/com/hbm/items/weapon/GunFolly.java b/src/main/java/com/hbm/items/weapon/GunFolly.java index 9fa3a0a8a..b796d477a 100644 --- a/src/main/java/com/hbm/items/weapon/GunFolly.java +++ b/src/main/java/com/hbm/items/weapon/GunFolly.java @@ -1,7 +1,7 @@ package com.hbm.items.weapon; import com.hbm.entity.particle.EntitySSmokeFX; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.interfaces.IHoldableWeapon; import com.hbm.items.ModItems; @@ -63,7 +63,7 @@ public class GunFolly extends Item implements IHoldableWeapon { player.motionZ -= player.getLookVec().zCoord * mult; if (!world.isRemote) { - EntityBulletBase bullet = new EntityBulletBase(world, BulletConfigSyncingUtil.TEST_CONFIG, player); + EntityBulletBaseNT bullet = new EntityBulletBaseNT(world, BulletConfigSyncingUtil.TEST_CONFIG, player); world.spawnEntityInWorld(bullet); for(int i = 0; i < 25; i++) { diff --git a/src/main/java/com/hbm/items/weapon/GunLeverAction.java b/src/main/java/com/hbm/items/weapon/GunLeverAction.java deleted file mode 100644 index a0980d7b5..000000000 --- a/src/main/java/com/hbm/items/weapon/GunLeverAction.java +++ /dev/null @@ -1,271 +0,0 @@ -package com.hbm.items.weapon; - -import java.util.List; -import java.util.Random; - -import com.google.common.collect.Multimap; -import com.hbm.entity.projectile.EntityBulletBase; -import com.hbm.handler.BulletConfigSyncingUtil; -import com.hbm.items.ModItems; - -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.player.ArrowLooseEvent; -import net.minecraftforge.event.entity.player.ArrowNockEvent; - -public class GunLeverAction extends Item { - - Random rand = new Random(); - - public int dmgMin = 8; - public int dmgMax = 16; - - public GunLeverAction() { - - this.maxStackSize = 1; - - if(this == ModItems.gun_lever_action) - this.setMaxDamage(500); - if(this == ModItems.gun_lever_action_dark) - this.setMaxDamage(750); - } - - /** - * called when the player releases the use item button. Args: itemstack, - * world, entityplayer, itemInUseCount - */ - @Override - public void onPlayerStoppedUsing(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_) { - int j = this.getMaxItemUseDuration(p_77615_1_) - p_77615_4_; - - ArrowLooseEvent event = new ArrowLooseEvent(p_77615_3_, p_77615_1_, j); - MinecraftForge.EVENT_BUS.post(event); - j = event.charge; - - boolean flag = p_77615_3_.capabilities.isCreativeMode - || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, p_77615_1_) > 0; - - if (flag || p_77615_3_.inventory.hasItem(ModItems.ammo_20gauge)) { - float f = j / 20.0F; - f = (f * f + f * 2.0F) / 3.0F; - - if (j < 10.0D) { - return; - } - - if (j > 10.0F) { - f = 10.0F; - } - EntityBulletBase entityarrow1; - EntityBulletBase entityarrow2; - EntityBulletBase entityarrow3; - EntityBulletBase entityarrow4; - EntityBulletBase entityarrow5; - EntityBulletBase entityarrow6; - EntityBulletBase entityarrow7; - EntityBulletBase entityarrow8; - EntityBulletBase entityarrow9; - EntityBulletBase entityarrow10; - - if (!p_77615_3_.isSneaking()) { - entityarrow1 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow2 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow3 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow4 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow5 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow6 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow7 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow8 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow9 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow10 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - } else { - entityarrow1 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow2 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow3 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow4 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow5 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow6 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow7 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow8 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow9 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - entityarrow10 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_); - } - - p_77615_1_.damageItem(1, p_77615_3_); - - p_77615_2_.playSoundAtEntity(p_77615_3_, "hbm:weapon.revolverShootAlt", 5.0F, 0.75F); - - if (flag) { } else { - p_77615_3_.inventory.consumeInventoryItem(ModItems.ammo_20gauge); - } - - if (!p_77615_2_.isRemote) { - p_77615_2_.spawnEntityInWorld(entityarrow1); - p_77615_2_.spawnEntityInWorld(entityarrow2); - p_77615_2_.spawnEntityInWorld(entityarrow3); - p_77615_2_.spawnEntityInWorld(entityarrow4); - - if (!p_77615_3_.isSneaking()) { - - p_77615_2_.spawnEntityInWorld(entityarrow5); - p_77615_2_.spawnEntityInWorld(entityarrow6); - - int i = rand.nextInt(5); - - if(i >= 1) - p_77615_2_.spawnEntityInWorld(entityarrow7); - if(i >= 2) - p_77615_2_.spawnEntityInWorld(entityarrow8); - if(i >= 3) - p_77615_2_.spawnEntityInWorld(entityarrow9); - if(i >= 4) - p_77615_2_.spawnEntityInWorld(entityarrow10); - } - } - - setAnim(p_77615_1_, 1); - } - } - - - @Override - public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean b) { - int j = getAnim(stack); - - if(j > 0) { - if(j < 30) - setAnim(stack, j + 1); - else - setAnim(stack, 0); - - if(j == 15) - world.playSoundAtEntity(entity, "hbm:weapon.leverActionReload", 2F, 0.85F); - } - - } - - @Override - public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_) { - return p_77654_1_; - } - - /** - * How long it takes to use or consume an item - */ - @Override - public int getMaxItemUseDuration(ItemStack p_77626_1_) { - return 72000; - } - - /** - * returns the action that specifies what animation to play when the items - * is being used - */ - @Override - public EnumAction getItemUseAction(ItemStack p_77661_1_) { - return EnumAction.bow; - } - - /** - * Called whenever this item is equipped and the right mouse button is - * pressed. Args: itemStack, world, entityPlayer - */ - @Override - public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { - ArrowNockEvent event = new ArrowNockEvent(p_77659_3_, p_77659_1_); - MinecraftForge.EVENT_BUS.post(event); - - if(this.getAnim(p_77659_1_) == 0) - p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_)); - - return p_77659_1_; - } - - /** - * Return the enchantability factor of the item, most of the time is based - * on material. - */ - @Override - public int getItemEnchantability() { - return 1; - } - - @Override - public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) { - - if(this == ModItems.gun_lever_action) - list.add("Universal head-to-spaghetti-sauce converter."); - if(this == ModItems.gun_lever_action_dark) - list.add("Blow your legs off!"); - list.add(""); - list.add("Ammo: 12x74 Buckshot"); - list.add("Damage: 8 - 16"); - list.add("Projectiles: 6 - 10"); - } - - @Override - public Multimap getItemAttributeModifiers() { - Multimap multimap = super.getItemAttributeModifiers(); - multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), - new AttributeModifier(field_111210_e, "Weapon modifier", 3.5, 0)); - return multimap; - } - - private static int getAnim(ItemStack stack) { - if(stack.stackTagCompound == null) { - stack.stackTagCompound = new NBTTagCompound(); - return 0; - } - - return stack.stackTagCompound.getInteger("animation"); - - } - - private static void setAnim(ItemStack stack, int i) { - if(stack.stackTagCompound == null) { - stack.stackTagCompound = new NBTTagCompound(); - } - - stack.stackTagCompound.setInteger("animation", i); - - } - - public static float getRotationFromAnim(ItemStack stack) { - float rad = 0.0174533F; - rad *= 7.5F; - int i = getAnim(stack); - - if(i < 10) - return 0; - i -= 10; - - if(i < 10) - return rad * i; - else - return (rad * 10) - (rad * (i - 10)); - } - - public static float getOffsetFromAnim(ItemStack stack) { - float i = getAnim(stack); - - if(i < 10) - return 0; - i -= 10; - - if(i < 10) - return i / 10; - else - return 2 - (i / 10); - } - -} diff --git a/src/main/java/com/hbm/items/weapon/GunOSIPR.java b/src/main/java/com/hbm/items/weapon/GunOSIPR.java deleted file mode 100644 index bae321b8e..000000000 --- a/src/main/java/com/hbm/items/weapon/GunOSIPR.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.hbm.items.weapon; - -import java.util.List; -import java.util.Random; - -import com.google.common.collect.Multimap; -import com.hbm.entity.projectile.EntityBullet; -import com.hbm.entity.projectile.EntityCombineBall; -import com.hbm.items.ModItems; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.event.entity.player.ArrowNockEvent; - -public class GunOSIPR extends Item { - - Random rand = new Random(); - - public GunOSIPR() - { - this.maxStackSize = 1; - this.setMaxDamage(2500); - } - - @Override - public EnumAction getItemUseAction(ItemStack par1ItemStack) { - return EnumAction.bow; - } - - @Override - public int getMaxItemUseDuration(ItemStack p_77626_1_) { - return 72000; - } - - @Override - public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { - new ArrowNockEvent(p_77659_3_, p_77659_1_); - { - p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_)); - } - - return p_77659_1_; - } - - @Override - public void onUsingTick(ItemStack stack, EntityPlayer player, int count) - { - World world = player.worldObj; - - if (!player.isSneaking()) { - boolean flag = player.capabilities.isCreativeMode - || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; - if ((player.capabilities.isCreativeMode || player.inventory.hasItem(ModItems.gun_osipr_ammo)) && count % 3 == 0) { - EntityBullet entityarrow = new EntityBullet(world, player, 3.0F, 5, 15, false, "chopper"); - entityarrow.setDamage(5 + rand.nextInt(10)); - - //world.playSoundAtEntity(player, "random.explode", 1.0F, 1.5F + (rand.nextFloat() / 4)); - world.playSoundAtEntity(player, "hbm:weapon.osiprShoot", 1.0F, 0.8F + (rand.nextFloat() * 0.4F)); - - if (flag) { - entityarrow.canBePickedUp = 2; - } else { - player.inventory.consumeInventoryItem(ModItems.gun_osipr_ammo); - } - - if (!world.isRemote) { - world.spawnEntityInWorld(entityarrow); - } - } - } else { - boolean flag = player.capabilities.isCreativeMode - || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; - if ((player.capabilities.isCreativeMode || player.inventory.hasItem(ModItems.gun_osipr_ammo2)) && count % 30 == 0 && (this.getMaxItemUseDuration(stack) - count) != 0) { - EntityCombineBall entityarrow = new EntityCombineBall(player.worldObj, player, 3.0F); - entityarrow.setDamage(35 + rand.nextInt(45 - 35)); - - //world.playSoundAtEntity(player, "tile.piston.in", 1.0F, 0.75F); - world.playSoundAtEntity(player, "hbm:weapon.singFlyby", 1.0F, 1F); - - if (flag) { - entityarrow.canBePickedUp = 2; - } else { - player.inventory.consumeInventoryItem(ModItems.gun_osipr_ammo2); - } - - if (!world.isRemote) { - world.spawnEntityInWorld(entityarrow); - } - } - - if((this.getMaxItemUseDuration(stack) - count) % 30 == 15 && (player.capabilities.isCreativeMode || player.inventory.hasItem(ModItems.gun_osipr_ammo2))) - world.playSoundAtEntity(player, "hbm:weapon.osiprCharging", 1.0F, 1F); - } - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) { - - list.add("Hold right mouse button"); - list.add("to shoot,"); - list.add("sneak to shoot a"); - list.add("dark energy ball!"); - list.add(""); - list.add("Ammo: Dark Energy Plugs"); - list.add("Secondary Ammo: Combine Ball"); - list.add("Damage: 5 - 15"); - list.add("Secondary Damage: 1000"); - } - - @Override - public Multimap getItemAttributeModifiers() { - Multimap multimap = super.getItemAttributeModifiers(); - multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), - new AttributeModifier(field_111210_e, "Weapon modifier", 5, 0)); - return multimap; - } - -} diff --git a/src/main/java/com/hbm/items/weapon/GunSMG.java b/src/main/java/com/hbm/items/weapon/GunSMG.java deleted file mode 100644 index e5cb4cf58..000000000 --- a/src/main/java/com/hbm/items/weapon/GunSMG.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.hbm.items.weapon; - -import java.util.List; -import java.util.Random; - -import com.google.common.collect.Multimap; -import com.hbm.entity.projectile.EntityBulletBase; -import com.hbm.handler.BulletConfigSyncingUtil; -import com.hbm.items.ModItems; - -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.event.entity.player.ArrowNockEvent; - -public class GunSMG extends Item { - - Random rand = new Random(); - - public GunSMG() - { - this.maxStackSize = 1; - } - - @Override - public EnumAction getItemUseAction(ItemStack par1ItemStack) { - return EnumAction.bow; - } - - @Override - public int getMaxItemUseDuration(ItemStack p_77626_1_) { - return 72000; - } - - @Override - public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { - new ArrowNockEvent(p_77659_3_, p_77659_1_); - { - p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_)); - } - - return p_77659_1_; - } - - @Override - public void onUsingTick(ItemStack stack, EntityPlayer player, int count) - { - World world = player.worldObj; - - boolean flag = player.capabilities.isCreativeMode - || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; - if ((player.capabilities.isCreativeMode || player.inventory.hasItem(ModItems.ammo_9mm)) - && count % 2 == 0) { - - EntityBulletBase bullet = new EntityBulletBase(world, BulletConfigSyncingUtil.TEST_CONFIG, player); - //EntityArrow bullet = new EntityArrow(world, player, 3.0F); - - //world.playSoundAtEntity(player, "random.explode", 1.0F, 1.5F + (rand.nextFloat() / 4)); - world.playSoundAtEntity(player, "hbm:weapon.rifleShoot", 1.0F, 0.8F + (rand.nextFloat() * 0.4F)); - - if (flag) { - } else { - player.inventory.consumeInventoryItem(ModItems.ammo_9mm); - } - - if (!world.isRemote) { - world.spawnEntityInWorld(bullet); - } - } - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) { - - list.add("Ratatatatatatatata!!"); - list.add(""); - list.add("Ammo: SMG Round"); - list.add("Damage: 2 - 8"); - } - - @Override - public Multimap getItemAttributeModifiers() { - Multimap multimap = super.getItemAttributeModifiers(); - multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), - new AttributeModifier(field_111210_e, "Weapon modifier", 3, 0)); - return multimap; - } -} diff --git a/src/main/java/com/hbm/items/weapon/GunShotgun.java b/src/main/java/com/hbm/items/weapon/GunShotgun.java deleted file mode 100644 index fe9b604d1..000000000 --- a/src/main/java/com/hbm/items/weapon/GunShotgun.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.hbm.items.weapon; - -import java.util.List; -import java.util.Random; - -import com.google.common.collect.Multimap; -import com.hbm.entity.projectile.EntityBullet; -import com.hbm.items.ModItems; - -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.player.ArrowLooseEvent; -import net.minecraftforge.event.entity.player.ArrowNockEvent; - -public class GunShotgun extends Item { - Random rand = new Random(); - - public int dmgMin = 3; - public int dmgMax = 7; - - public GunShotgun() { - - this.maxStackSize = 1; - - if (this == ModItems.gun_uboinik) { - this.setMaxDamage(500); - } - } - - /** - * called when the player releases the use item button. Args: itemstack, - * world, entityplayer, itemInUseCount - */ - @Override - public void onPlayerStoppedUsing(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_) { - int j = this.getMaxItemUseDuration(p_77615_1_) - p_77615_4_; - - ArrowLooseEvent event = new ArrowLooseEvent(p_77615_3_, p_77615_1_, j); - MinecraftForge.EVENT_BUS.post(event); - j = event.charge; - - boolean flag = p_77615_3_.capabilities.isCreativeMode - || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, p_77615_1_) > 0; - - if (flag || p_77615_3_.inventory.hasItem(ModItems.ammo_12gauge)) { - float f = j / 20.0F; - f = (f * f + f * 2.0F) / 3.0F; - - if (j < 10.0D) { - return; - } - - if (j > 10.0F) { - f = 10.0F; - } - - EntityBullet entityarrow1 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F); - entityarrow1.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin)); - EntityBullet entityarrow2 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F); - entityarrow2.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin)); - EntityBullet entityarrow3 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F); - entityarrow3.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin)); - EntityBullet entityarrow4 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F); - entityarrow4.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin)); - EntityBullet entityarrow5 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F); - entityarrow5.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin)); - EntityBullet entityarrow6 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F); - entityarrow6.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin)); - EntityBullet entityarrow7 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F); - entityarrow7.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin)); - EntityBullet entityarrow8 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F); - entityarrow8.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin)); - EntityBullet entityarrow9 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F); - entityarrow9.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin)); - EntityBullet entityarrow10 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F); - entityarrow10.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin)); - EntityBullet entityarrow11 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F); - entityarrow11.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin)); - EntityBullet entityarrow12 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F); - entityarrow12.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin)); - - p_77615_1_.damageItem(1, p_77615_3_); - - p_77615_2_.playSoundAtEntity(p_77615_3_, "hbm:weapon.shotgunShoot", 1.0F, 1.0F); - - if (flag) { } else { - p_77615_3_.inventory.consumeInventoryItem(ModItems.ammo_12gauge); - } - - if (!p_77615_2_.isRemote) { - p_77615_2_.spawnEntityInWorld(entityarrow1); - p_77615_2_.spawnEntityInWorld(entityarrow2); - p_77615_2_.spawnEntityInWorld(entityarrow3); - p_77615_2_.spawnEntityInWorld(entityarrow4); - p_77615_2_.spawnEntityInWorld(entityarrow5); - p_77615_2_.spawnEntityInWorld(entityarrow6); - - int i = rand.nextInt(7); - - if(i >= 1) - p_77615_2_.spawnEntityInWorld(entityarrow7); - if(i >= 2) - p_77615_2_.spawnEntityInWorld(entityarrow8); - if(i >= 3) - p_77615_2_.spawnEntityInWorld(entityarrow9); - if(i >= 4) - p_77615_2_.spawnEntityInWorld(entityarrow10); - if(i >= 5) - p_77615_2_.spawnEntityInWorld(entityarrow11); - if(i >= 6) - p_77615_2_.spawnEntityInWorld(entityarrow12); - } - } - } - - @Override - public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_) { - return p_77654_1_; - } - - /** - * How long it takes to use or consume an item - */ - @Override - public int getMaxItemUseDuration(ItemStack p_77626_1_) { - return 72000; - } - - /** - * returns the action that specifies what animation to play when the items - * is being used - */ - @Override - public EnumAction getItemUseAction(ItemStack p_77661_1_) { - return EnumAction.bow; - } - - /** - * Called whenever this item is equipped and the right mouse button is - * pressed. Args: itemStack, world, entityPlayer - */ - @Override - public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { - ArrowNockEvent event = new ArrowNockEvent(p_77659_3_, p_77659_1_); - MinecraftForge.EVENT_BUS.post(event); - - p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_)); - - return p_77659_1_; - } - - /** - * Return the enchantability factor of the item, most of the time is based - * on material. - */ - @Override - public int getItemEnchantability() { - return 1; - } - - @Override - public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) { - - //list.add("POW! Haha!"); - list.add("Abracadabra Tomanakara!"); - list.add(""); - list.add("Ammo: 12x70 Buckshot"); - list.add("Damage: 3 - 7"); - list.add("Projectiles: 6 - 12"); - } - - @Override - public Multimap getItemAttributeModifiers() { - Multimap multimap = super.getItemAttributeModifiers(); - multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), - new AttributeModifier(field_111210_e, "Weapon modifier", 3.5, 0)); - return multimap; - } -} diff --git a/src/main/java/com/hbm/items/weapon/ItemAmmoHIMARS.java b/src/main/java/com/hbm/items/weapon/ItemAmmoHIMARS.java index f631a8a97..4eac7ec1f 100644 --- a/src/main/java/com/hbm/items/weapon/ItemAmmoHIMARS.java +++ b/src/main/java/com/hbm/items/weapon/ItemAmmoHIMARS.java @@ -186,7 +186,7 @@ public class ItemAmmoHIMARS extends Item { this.itemTypes[SMALL_WP] = new HIMARSRocket("standard_wp", "himars_standard_wp", 0) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { - standardExplosion(rocket, mop, 20F, 3F, false, ModBlocks.slag, 1); + standardExplosion(rocket, mop, 20F, 3F, false, ModBlocks.block_slag, 1); ExplosionLarge.spawnShrapnels(rocket.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 30); ExplosionChaos.burn(rocket.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 20); int radius = 30; @@ -209,7 +209,7 @@ public class ItemAmmoHIMARS extends Item { this.itemTypes[SMALL_TB] = new HIMARSRocket("standard_tb", "himars_standard_tb", 0) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { - standardExplosion(rocket, mop, 20F, 10F, true, ModBlocks.slag, 1); + standardExplosion(rocket, mop, 20F, 10F, true, ModBlocks.block_slag, 1); ExplosionLarge.spawnShrapnels(rocket.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 30); standardMush(rocket, mop, 20); }}; diff --git a/src/main/java/com/hbm/items/weapon/ItemGunBase.java b/src/main/java/com/hbm/items/weapon/ItemGunBase.java index 930366673..e2b428c7e 100644 --- a/src/main/java/com/hbm/items/weapon/ItemGunBase.java +++ b/src/main/java/com/hbm/items/weapon/ItemGunBase.java @@ -5,7 +5,6 @@ import java.util.List; import org.lwjgl.input.Mouse; import com.hbm.config.GeneralConfig; -import com.hbm.entity.projectile.EntityBulletBase; import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; diff --git a/src/main/java/com/hbm/items/weapon/ItemGunGauss.java b/src/main/java/com/hbm/items/weapon/ItemGunGauss.java index 1d53bb44c..7dd20b1a0 100644 --- a/src/main/java/com/hbm/items/weapon/ItemGunGauss.java +++ b/src/main/java/com/hbm/items/weapon/ItemGunGauss.java @@ -1,6 +1,6 @@ package com.hbm.items.weapon; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.handler.GunConfiguration; import com.hbm.items.ModItems; import com.hbm.lib.ModDamageSource; @@ -31,7 +31,7 @@ public class ItemGunGauss extends ItemGunBase { } if(!main && getStored(stack) > 0) { - EntityBulletBase bullet = new EntityBulletBase(world, altConfig.config.get(0), player); + EntityBulletBaseNT bullet = new EntityBulletBaseNT(world, altConfig.config.get(0), player); bullet.overrideDamage = Math.max(getStored(stack), 1) * 10F; world.spawnEntityInWorld(bullet); world.playSoundAtEntity(player, "hbm:weapon.tauShoot", 0.5F, 0.75F); diff --git a/src/main/java/com/hbm/items/weapon/gununified/ItemEnergyGunBase.java b/src/main/java/com/hbm/items/weapon/gununified/ItemEnergyGunBase.java index 21dc8448a..e137eda14 100644 --- a/src/main/java/com/hbm/items/weapon/gununified/ItemEnergyGunBase.java +++ b/src/main/java/com/hbm/items/weapon/gununified/ItemEnergyGunBase.java @@ -5,7 +5,7 @@ import java.util.List; import org.lwjgl.input.Mouse; import com.hbm.config.GeneralConfig; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; import com.hbm.handler.GunConfiguration; @@ -140,7 +140,7 @@ public class ItemEnergyGunBase extends ItemGunBase implements IBatteryItem { protected void spawnProjectile(World world, EntityPlayer player, ItemStack stack, int config) { - EntityBulletBase bullet = new EntityBulletBase(world, config, player); + EntityBulletBaseNT bullet = new EntityBulletBaseNT(world, config, player); world.spawnEntityInWorld(bullet); if(this.mainConfig.animations.containsKey(AnimType.CYCLE) && player instanceof EntityPlayerMP) diff --git a/src/main/java/com/hbm/lib/RefStrings.java b/src/main/java/com/hbm/lib/RefStrings.java index 6d1da286d..55bb20699 100644 --- a/src/main/java/com/hbm/lib/RefStrings.java +++ b/src/main/java/com/hbm/lib/RefStrings.java @@ -3,7 +3,7 @@ package com.hbm.lib; public class RefStrings { public static final String MODID = "hbm"; public static final String NAME = "Hbm's Nuclear Tech Mod"; - public static final String VERSION = "1.0.27 BETA (4655)"; + public static final String VERSION = "1.0.27 BETA (4663)"; //HBM's Beta Naming Convention: //V T (X) //V -> next release version diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index 062c70bda..14d0c8a6e 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -547,7 +547,6 @@ public class ClientProxy extends ServerProxy { RenderingRegistry.registerEntityRenderingHandler(EntityRocket.class, new RenderSnowball(ModItems.man_core)); RenderingRegistry.registerEntityRenderingHandler(EntitySchrab.class, new RenderFlare()); RenderingRegistry.registerEntityRenderingHandler(EntityBullet.class, new RenderRocket()); - RenderingRegistry.registerEntityRenderingHandler(EntityBulletBase.class, new RenderBullet()); RenderingRegistry.registerEntityRenderingHandler(EntityBulletBaseNT.class, new RenderBullet()); RenderingRegistry.registerEntityRenderingHandler(EntityRainbow.class, new RenderRainbow()); RenderingRegistry.registerEntityRenderingHandler(EntityNightmareBlast.class, new RenderOminousBullet()); diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 368aaf55d..1893862f8 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -293,6 +293,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.machine_turbine, 1), new Object[] { "SMS", "PTP", "SMS", 'S', STEEL.ingot(), 'T', ModItems.turbine_titanium, 'M', ModItems.coil_copper, 'P', ANY_PLASTIC.ingot() }); addRecipeAuto(new ItemStack(ModBlocks.machine_converter_he_rf, 1), new Object[] { "SSS", "CRB", "SSS", 'S', STEEL.ingot(), 'C', ModItems.coil_copper, 'R', ModItems.coil_copper_torus, 'B', REDSTONE.block() }); addRecipeAuto(new ItemStack(ModBlocks.machine_converter_rf_he, 1), new Object[] { "SSS", "BRC", "SSS", 'S', BE.ingot(), 'C', ModItems.coil_copper, 'R', ModItems.coil_copper_torus, 'B', REDSTONE.block() }); + addRecipeAuto(new ItemStack(ModBlocks.crate_template, 1), new Object[] { "IPI", "P P", "IPI", 'I', IRON.ingot(), 'P', Items.paper }); addRecipeAuto(new ItemStack(ModBlocks.crate_iron, 1), new Object[] { "PPP", "I I", "III", 'P', IRON.plate(), 'I', IRON.ingot() }); addRecipeAuto(new ItemStack(ModBlocks.crate_steel, 1), new Object[] { "PPP", "I I", "III", 'P', STEEL.plate(), 'I', STEEL.ingot() }); addRecipeAuto(new ItemStack(ModBlocks.crate_desh, 1), new Object[] { " D ", "DSD", " D ", 'D', ModItems.plate_desh, 'S', ModBlocks.crate_steel }); diff --git a/src/main/java/com/hbm/main/ModEventHandler.java b/src/main/java/com/hbm/main/ModEventHandler.java index 6a38a081a..7197df144 100644 --- a/src/main/java/com/hbm/main/ModEventHandler.java +++ b/src/main/java/com/hbm/main/ModEventHandler.java @@ -27,7 +27,7 @@ import com.hbm.entity.mob.EntityDuck; import com.hbm.entity.mob.EntityCreeperNuclear; import com.hbm.entity.mob.EntityQuackos; import com.hbm.entity.mob.EntityCreeperTainted; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.entity.projectile.EntityBurningFOEQ; import com.hbm.entity.train.EntityRailCarBase; import com.hbm.extprop.HbmLivingProps; @@ -844,7 +844,7 @@ public class ModEventHandler { } for(int i = 0; i < bullets; i++) { - EntityBulletBase bullet = new EntityBulletBase(player.worldObj, BulletConfigSyncingUtil.getKey(firedConfig), player); + EntityBulletBaseNT bullet = new EntityBulletBaseNT(player.worldObj, BulletConfigSyncingUtil.getKey(firedConfig), player); player.worldObj.spawnEntityInWorld(bullet); } diff --git a/src/main/java/com/hbm/render/tileentity/RendererObjTester.java b/src/main/java/com/hbm/render/tileentity/RendererObjTester.java index 467a4c14a..eabd2569a 100644 --- a/src/main/java/com/hbm/render/tileentity/RendererObjTester.java +++ b/src/main/java/com/hbm/render/tileentity/RendererObjTester.java @@ -6,25 +6,15 @@ import org.lwjgl.BufferUtils; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import com.hbm.items.ModItems; -import com.hbm.lib.RefStrings; import com.hbm.main.ResourceManager; -import com.hbm.render.loader.HFRWavefrontObject; -import com.hbm.render.util.HorsePronter; -import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; public class RendererObjTester extends TileEntitySpecialRenderer { - private static final ResourceLocation objTesterModelRL = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/TestObj.obj"); + //private static final ResourceLocation objTesterModelRL = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/TestObj.obj"); @Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) { diff --git a/src/main/java/com/hbm/tileentity/TileMappings.java b/src/main/java/com/hbm/tileentity/TileMappings.java index dd348ddce..896858233 100644 --- a/src/main/java/com/hbm/tileentity/TileMappings.java +++ b/src/main/java/com/hbm/tileentity/TileMappings.java @@ -96,6 +96,7 @@ public class TileMappings { put(TileEntityMachineFluidTank.class, "tileentity_fluid_tank"); put(TileEntityMachineTurbofan.class, "tileentity_machine_turbofan"); put(TileEntityMachineTurbineGas.class, "tileentity_machine_gasturbine"); + put(TileEntityCrateTemplate.class, "tileentity_crate_template"); put(TileEntityCrateIron.class, "tileentity_crate_iron"); put(TileEntityCrateSteel.class, "tileentity_crate_steel"); put(TileEntityCrateDesh.class, "tileentity_crate_desh"); diff --git a/src/main/java/com/hbm/tileentity/conductor/TileEntityFluidDuctSimple.java b/src/main/java/com/hbm/tileentity/conductor/TileEntityFluidDuctSimple.java index 60e93c1fd..9027eca23 100644 --- a/src/main/java/com/hbm/tileentity/conductor/TileEntityFluidDuctSimple.java +++ b/src/main/java/com/hbm/tileentity/conductor/TileEntityFluidDuctSimple.java @@ -21,7 +21,6 @@ import net.minecraftforge.common.util.ForgeDirection; public class TileEntityFluidDuctSimple extends TileEntity implements IFluidDuct { - private FluidType lastType = Fluids.NONE; protected FluidType type = Fluids.NONE; public List uoteab = new ArrayList(); diff --git a/src/main/java/com/hbm/tileentity/deco/TileEntityTrappedBrick.java b/src/main/java/com/hbm/tileentity/deco/TileEntityTrappedBrick.java index af014a09c..5dcef1aad 100644 --- a/src/main/java/com/hbm/tileentity/deco/TileEntityTrappedBrick.java +++ b/src/main/java/com/hbm/tileentity/deco/TileEntityTrappedBrick.java @@ -6,7 +6,7 @@ import java.util.List; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.TrappedBrick.Trap; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.entity.projectile.EntityRubble; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.items.ModItems; @@ -77,7 +77,7 @@ public class TileEntityTrappedBrick extends TileEntity { worldObj.setBlock(xCoord, yCoord - 1 - i, zCoord, ModBlocks.concrete_pillar); break; case POISON_DART: - EntityBulletBase dart = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.G20_CAUSTIC); + EntityBulletBaseNT dart = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.G20_CAUSTIC); dart.setPosition(xCoord + 0.5 + dir.offsetX, yCoord + 0.5, zCoord + 0.5 + dir.offsetZ); dart.motionX = dir.offsetX; dart.motionZ = dir.offsetZ; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java index 4c754fabe..452a614e9 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java @@ -1,64 +1,38 @@ package com.hbm.tileentity.machine; -import java.util.ArrayList; -import java.util.List; import java.util.Random; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; import com.hbm.handler.MultiblockHandlerXR; -import com.hbm.inventory.RecipesCommon.AStack; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.inventory.UpgradeManager; import com.hbm.inventory.container.ContainerMachineAssembler; import com.hbm.inventory.gui.GUIMachineAssembler; import com.hbm.inventory.recipes.AssemblerRecipes; -import com.hbm.items.ModItems; import com.hbm.items.machine.ItemAssemblyTemplate; import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; -import com.hbm.lib.Library; import com.hbm.main.MainRegistry; import com.hbm.sound.AudioWrapper; -import com.hbm.tileentity.IGUIProvider; -import com.hbm.tileentity.TileEntityMachineBase; -import com.hbm.tileentity.machine.storage.TileEntityCrateBase; -import com.hbm.tileentity.machine.storage.TileEntityCrateIron; -import com.hbm.tileentity.machine.storage.TileEntityCrateSteel; import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.energy.IBatteryItem; -import api.hbm.energy.IEnergyUser; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.tileentity.TileEntityHopper; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityMachineAssembler extends TileEntityMachineBase implements IEnergyUser, IGUIProvider { +public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase { + + public int recipe = -1; - public long power; - public static final long maxPower = 100000; - public int progress; - public int maxProgress = 100; - public boolean isProgressing; - int age = 0; - int consumption = 100; - int speed = 100; - - @SideOnly(Side.CLIENT) - public int recipe; //don't initialize this, retard - - private AudioWrapper audio; - Random rand = new Random(); public TileEntityMachineAssembler() { @@ -82,52 +56,9 @@ public class TileEntityMachineAssembler extends TileEntityMachineBase implements return false; } - @Override - public ItemStack decrStackSize(int i, int j) { - if(slots[i] != null) - { - if(slots[i].stackSize <= j) - { - ItemStack itemStack = slots[i]; - slots[i] = null; - return itemStack; - } - ItemStack itemStack1 = slots[i].splitStack(j); - if (slots[i].stackSize == 0) - { - slots[i] = null; - } - - return itemStack1; - } else { - return null; - } - } - - @Override - public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(nbt); - this.power = nbt.getLong("powerTime"); - this.progress = nbt.getInteger("progress"); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(nbt); - nbt.setLong("powerTime", power); - nbt.setInteger("progress", progress); - } - - public long getPowerScaled(long i) { - return (power * i) / maxPower; - } - - public int getProgressScaled(int i) { - return (progress * i) / maxProgress; - } - @Override public void updateEntity() { + super.updateEntity(); if(!worldObj.isRemote) { @@ -170,77 +101,6 @@ public class TileEntityMachineAssembler extends TileEntityMachineBase implements speed /= (overLevel + 1); consumption *= (overLevel + 1); - isProgressing = false; - power = Library.chargeTEFromItems(slots, 0, power, maxPower); - - if(AssemblerRecipes.getOutputFromTempate(slots[4]) != null && AssemblerRecipes.getRecipeFromTempate(slots[4]) != null) { - this.maxProgress = (ItemAssemblyTemplate.getProcessTime(slots[4]) * speed) / 100; - - if(power >= consumption && removeItems(AssemblerRecipes.getRecipeFromTempate(slots[4]), cloneItemStackProper(slots))) { - - if(slots[5] == null || (slots[5] != null && slots[5].getItem() == AssemblerRecipes.getOutputFromTempate(slots[4]).copy().getItem()) && slots[5].stackSize + AssemblerRecipes.getOutputFromTempate(slots[4]).copy().stackSize <= slots[5].getMaxStackSize()) { - progress++; - isProgressing = true; - - if(progress >= maxProgress) { - progress = 0; - if(slots[5] == null) { - slots[5] = AssemblerRecipes.getOutputFromTempate(slots[4]).copy(); - } else { - slots[5].stackSize += AssemblerRecipes.getOutputFromTempate(slots[4]).copy().stackSize; - } - - removeItems(AssemblerRecipes.getRecipeFromTempate(slots[4]), slots); - - if(slots[0] != null && slots[0].getItem() == ModItems.meteorite_sword_alloyed) - slots[0] = new ItemStack(ModItems.meteorite_sword_machined); - } - - power -= consumption; - } - } else - progress = 0; - } else - progress = 0; - - int meta = worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord); - - TileEntity te1 = null; - TileEntity te2 = null; - - if(meta == 14) { - te1 = worldObj.getTileEntity(xCoord - 2, yCoord, zCoord); - te2 = worldObj.getTileEntity(xCoord + 3, yCoord, zCoord - 1); - } - if(meta == 15) { - te1 = worldObj.getTileEntity(xCoord + 2, yCoord, zCoord); - te2 = worldObj.getTileEntity(xCoord - 3, yCoord, zCoord + 1); - } - if(meta == 13) { - te1 = worldObj.getTileEntity(xCoord, yCoord, zCoord + 2); - te2 = worldObj.getTileEntity(xCoord - 1, yCoord, zCoord - 3); - } - if(meta == 12) { - te1 = worldObj.getTileEntity(xCoord, yCoord, zCoord - 2); - te2 = worldObj.getTileEntity(xCoord + 1, yCoord, zCoord + 3); - } - - tryExchangeTemplates(te1, te2); - - //OUTPUT - if(te1 instanceof TileEntityCrateBase || te1 instanceof TileEntityChest) { - IInventory chest = (IInventory)te1; - tryFillContainer(chest, 5); - } - - if(te2 instanceof TileEntityCrateBase || te2 instanceof TileEntityChest) { - IInventory chest = (IInventory)te2; - - for(int i = 0; i < chest.getSizeInventory(); i++) - if(tryFillAssembler(chest, i)) - break; - } - int rec = -1; if(AssemblerRecipes.getOutputFromTempate(slots[4]) != null) { ComparableStack comp = ItemAssemblyTemplate.readType(slots[4]); @@ -249,8 +109,8 @@ public class TileEntityMachineAssembler extends TileEntityMachineBase implements NBTTagCompound data = new NBTTagCompound(); data.setLong("power", power); - data.setInteger("progress", progress); - data.setInteger("maxProgress", maxProgress); + data.setIntArray("progress", this.progress); + data.setIntArray("maxProgress", this.maxProgress); data.setBoolean("isProgressing", isProgressing); data.setInteger("recipe", rec); this.networkPack(data, 150); @@ -278,6 +138,15 @@ public class TileEntityMachineAssembler extends TileEntityMachineBase implements } } } + + @Override + public void networkUnpack(NBTTagCompound nbt) { + this.power = nbt.getLong("power"); + this.progress = nbt.getIntArray("progress"); + this.maxProgress = nbt.getIntArray("maxProgress"); + this.isProgressing = nbt.getBoolean("isProgressing"); + this.recipe = nbt.getInteger("recipe"); + } @Override public AudioWrapper createAudioLoop() { @@ -303,307 +172,65 @@ public class TileEntityMachineAssembler extends TileEntityMachineBase implements new DirPos(xCoord - rot.offsetX * 2 + dir.offsetX, yCoord, zCoord - rot.offsetZ * 2 + dir.offsetZ, rot.getOpposite()) }; } - - public void onChunkUnload() { - - if(audio != null) { - audio.stopSound(); - audio = null; - } - } - - public void invalidate() { - - super.invalidate(); - - if(audio != null) { - audio.stopSound(); - audio = null; - } - } - - public void networkUnpack(NBTTagCompound nbt) { - this.power = nbt.getLong("power"); - this.progress = nbt.getInteger("progress"); - this.maxProgress = nbt.getInteger("maxProgress"); - this.isProgressing = nbt.getBoolean("isProgressing"); - this.recipe = nbt.getInteger("recipe"); - } - - private boolean removeItems(List stack, ItemStack[] array) { - - if(stack == null) - return false; - - for(int i = 0; i < stack.size(); i++) { - for(int j = 0; j < stack.get(i).stacksize; j++) { - AStack sta = stack.get(i).copy(); - sta.stacksize = 1; - - if(!canRemoveItemFromArray(sta, array)) - return false; - } - } - - return true; - } - - public boolean canRemoveItemFromArray(AStack stack, ItemStack[] array) { - - AStack st = stack.copy(); - - if(st == null) - return true; - - for(int i = 6; i < 18; i++) { - - if(array[i] != null) { - - ItemStack sta = array[i].copy(); - sta.stackSize = 1; - - if(sta != null && st.isApplicable(sta) && array[i].stackSize > 0) { - array[i].stackSize--; - - if(array[i].stackSize <= 0) - array[i] = null; - - return true; - } - } - } - - return false; - } - - public boolean tryExchangeTemplates(TileEntity te1, TileEntity te2) { - //validateTe sees if it's a valid inventory tile entity - boolean te1Valid = validateTe(te1); - boolean te2Valid = validateTe(te2); - - if(te1Valid && te2Valid){ - IInventory iTe1 = (IInventory)te1; - IInventory iTe2 = (IInventory)te2; - boolean openSlot = false; - boolean existingTemplate = false; - boolean filledContainer = false; - //Check if there's an existing template and an open slot - for(int i = 0; i < iTe1.getSizeInventory(); i++){ - if(iTe1.getStackInSlot(i) == null){ - openSlot = true; - - } - - } - if(this.slots[4] != null){ - existingTemplate = true; - } - //Check if there's a template in input - for(int i = 0; i < iTe2.getSizeInventory(); i++){ - if(iTe2.getStackInSlot(i) != null && iTe2.getStackInSlot(i).getItem() instanceof ItemAssemblyTemplate){ - if(openSlot && existingTemplate){ - filledContainer = tryFillContainer(iTe1, 4); - - } - if(filledContainer){ - ItemStack copy = iTe2.getStackInSlot(i).copy(); - iTe2.setInventorySlotContents(i, null); - this.slots[4] = copy; - } - } - - } - - - } - return false; - - } - - private boolean validateTe(TileEntity te) { - if(te instanceof TileEntityChest) { - return true; - } - - if(te instanceof TileEntityHopper) { - return true; - } - - if(te instanceof TileEntityCrateIron) { - return true; - } - - if(te instanceof TileEntityCrateSteel) { - return true; - } - - return false; - } - - //I can't believe that worked. - public ItemStack[] cloneItemStackProper(ItemStack[] array) { - ItemStack[] stack = new ItemStack[array.length]; - - for(int i = 0; i < array.length; i++) - if(array[i] != null) - stack[i] = array[i].copy(); - else - stack[i] = null; - - return stack; - } - - //Unloads output into chests - public boolean tryFillContainer(IInventory inventory, int slot) { - - int size = inventory.getSizeInventory(); - - for(int i = 0; i < size; i++) { - if(inventory.getStackInSlot(i) != null) { - - if(slots[slot] == null) - return false; - - ItemStack sta1 = inventory.getStackInSlot(i).copy(); - ItemStack sta2 = slots[slot].copy(); - if(sta1 != null && sta2 != null) { - sta1.stackSize = 1; - sta2.stackSize = 1; - - if(ItemStack.areItemStacksEqual(sta1, sta2) && ItemStack.areItemStackTagsEqual(sta1, sta2) && inventory.getStackInSlot(i).stackSize < inventory.getStackInSlot(i).getMaxStackSize()) { - slots[slot].stackSize--; - - if(slots[slot].stackSize <= 0) - slots[slot] = null; - - ItemStack sta3 = inventory.getStackInSlot(i).copy(); - sta3.stackSize++; - inventory.setInventorySlotContents(i, sta3); - - return true; - } - } - } - } - for(int i = 0; i < size; i++) { - - if(slots[slot] == null) - return false; - - ItemStack sta2 = slots[slot].copy(); - if(inventory.getStackInSlot(i) == null && sta2 != null) { - sta2.stackSize = 1; - slots[slot].stackSize--; - - if(slots[slot].stackSize <= 0) - slots[slot] = null; - - inventory.setInventorySlotContents(i, sta2); - - return true; - } - } - - return false; - } - - public boolean tryFillAssembler(IInventory inventory, int slot) { - - if(AssemblerRecipes.getOutputFromTempate(slots[4]) == null || AssemblerRecipes.getRecipeFromTempate(slots[4]) == null) - return false; - else { - List list = copyItemStackList(AssemblerRecipes.getRecipeFromTempate(slots[4])); - - for(int i = 0; i < list.size(); i++) - list.get(i).stacksize = 1; - - - if(inventory.getStackInSlot(slot) == null) - return false; - - ItemStack stack = inventory.getStackInSlot(slot).copy(); - stack.stackSize = 1; - - boolean flag = false; - - for(int i = 0; i < list.size(); i++) - if(list.get(i).isApplicable(stack)) - flag = true; - - if(!flag) - return false; - - } - - for(int i = 6; i < 18; i++) { - - if(slots[i] != null) { - - ItemStack sta1 = inventory.getStackInSlot(slot).copy(); - ItemStack sta2 = slots[i].copy(); - if(sta1 != null && sta2 != null) { - sta1.stackSize = 1; - sta2.stackSize = 1; - - if(sta1.isItemEqual(sta2) && slots[i].stackSize < slots[i].getMaxStackSize()) { - ItemStack sta3 = inventory.getStackInSlot(slot).copy(); - sta3.stackSize--; - if(sta3.stackSize <= 0) - sta3 = null; - inventory.setInventorySlotContents(slot, sta3); - - slots[i].stackSize++; - return true; - } - } - } - } - - for(int i = 6; i < 18; i++) { - - ItemStack sta2 = inventory.getStackInSlot(slot).copy(); - if(slots[i] == null && sta2 != null) { - sta2.stackSize = 1; - slots[i] = sta2.copy(); - - ItemStack sta3 = inventory.getStackInSlot(slot).copy(); - sta3.stackSize--; - if(sta3.stackSize <= 0) - sta3 = null; - inventory.setInventorySlotContents(slot, sta3); - - return true; - } - } - - return false; - } - - public static List copyItemStackList(List list){ - List newList = new ArrayList(); - if(list == null || list.isEmpty()) - return newList; - for(AStack stack : list){ - newList.add(stack.copy()); - } - return newList; - } @Override - public void setPower(long i) { - power = i; - + public void onChunkUnload() { + + if(audio != null) { + audio.stopSound(); + audio = null; + } } @Override - public long getPower() { - return power; - + public void invalidate() { + + super.invalidate(); + + if(audio != null) { + audio.stopSound(); + audio = null; + } + } + + private AudioWrapper audio; + + @Override + public int getRecipeCount() { + return 1; + } + + @Override + public int getTemplateIndex(int index) { + return 4; + } + + @Override + public int[] getSlotIndicesFromIndex(int index) { + return new int[] {6, 17, 5}; + } + + @Override + public ChunkCoordinates[] getInputPositions() { + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); + return new ChunkCoordinates[] {new ChunkCoordinates(xCoord - dir.offsetX * 3 + rot.offsetX, yCoord, zCoord - dir.offsetZ * 3 + rot.offsetZ)}; + } + + @Override + public ChunkCoordinates[] getOutputPositions() { + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); + return new ChunkCoordinates[] {new ChunkCoordinates(xCoord + dir.offsetX * 2, yCoord, zCoord + dir.offsetZ * 2)}; + } + + @Override + public int getPowerSlot() { + return 0; } @Override public long getMaxPower() { - return maxPower; + return 100_000; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblerBase.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblerBase.java index 587b14e85..aa5c7fec8 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblerBase.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblerBase.java @@ -9,6 +9,7 @@ import com.hbm.items.machine.ItemAssemblyTemplate; import com.hbm.lib.Library; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.tileentity.machine.storage.TileEntityCrateTemplate; import com.hbm.util.InventoryUtil; import api.hbm.energy.IEnergyUser; @@ -24,6 +25,7 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa public int[] progress; public int[] maxProgress; public boolean isProgressing; + public boolean[] needsTemplateSwitch; int consumption = 100; int speed = 100; @@ -35,6 +37,7 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa progress = new int[count]; maxProgress = new int[count]; + needsTemplateSwitch = new boolean[count]; } @Override @@ -45,11 +48,11 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa int count = this.getRecipeCount(); this.isProgressing = false; - this.power = Library.chargeTEFromItems(slots, 0, power, this.getMaxPower()); + this.power = Library.chargeTEFromItems(slots, getPowerSlot(), power, this.getMaxPower()); for(int i = 0; i < count; i++) { - loadItems(i); unloadItems(i); + loadItems(i); } @@ -114,6 +117,7 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa consumeItems(recipe, index); produceItems(output, index); this.progress[index] = 0; + this.needsTemplateSwitch[index] = true; this.markDirty(); } } @@ -140,53 +144,76 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa private void loadItems(int index) { int template = getTemplateIndex(index); - if(slots[template] == null || slots[template].getItem() != ModItems.assembly_template) - return; - List recipe = AssemblerRecipes.getRecipeFromTempate(slots[template]); - - if(recipe != null) { - - ChunkCoordinates[] positions = getInputPositions(); - int[] indices = getSlotIndicesFromIndex(index); - - for(ChunkCoordinates coord : positions) { + ChunkCoordinates[] positions = getInputPositions(); + int[] indices = getSlotIndicesFromIndex(index); + + for(ChunkCoordinates coord : positions) { + + TileEntity te = worldObj.getTileEntity(coord.posX, coord.posY, coord.posZ); - TileEntity te = worldObj.getTileEntity(coord.posX, coord.posY, coord.posZ); - - if(te instanceof IInventory) { + if(te instanceof IInventory) { + + IInventory inv = (IInventory) te; + ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null; + boolean templateCrate = te instanceof TileEntityCrateTemplate; + + if(templateCrate && slots[template] == null) { + + for(int i = 0; i < inv.getSizeInventory(); i++) { + ItemStack stack = inv.getStackInSlot(i); + + if(stack != null && stack.getItem() == ModItems.assembly_template && (sided == null || sided.canExtractItem(i, stack, 0))) { + slots[template] = stack.copy(); + sided.setInventorySlotContents(i, null); + this.needsTemplateSwitch[index] = false; + break; + } + } + } - IInventory inv = (IInventory) te; - ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null; - - for(AStack ingredient : recipe) { - - if(!InventoryUtil.doesArrayHaveIngredients(slots, indices[0], indices[1], ingredient)) { - - for(int i = 0; i < inv.getSizeInventory(); i++) { - - ItemStack stack = inv.getStackInSlot(i); - if(ingredient.matchesRecipe(stack, true) && (sided == null || sided.canExtractItem(i, stack, 0))) { - - for(int j = indices[0]; j <= indices[1]; j++) { - - if(slots[j] != null && slots[j].stackSize < slots[j].getMaxStackSize() & InventoryUtil.doesStackDataMatch(slots[j], stack)) { - inv.decrStackSize(i, 1); - slots[j].stackSize++; - return; + boolean noTemplate = slots[template] == null || slots[template].getItem() != ModItems.assembly_template; + + if(!noTemplate) { + + List recipe = AssemblerRecipes.getRecipeFromTempate(slots[template]); + + if(recipe != null) { + + for(AStack ingredient : recipe) { + + outer: while(!InventoryUtil.doesArrayHaveIngredients(slots, indices[0], indices[1], ingredient)) { + + boolean found = false; + + for(int i = 0; i < inv.getSizeInventory(); i++) { + + ItemStack stack = inv.getStackInSlot(i); + if(ingredient.matchesRecipe(stack, true) && (sided == null || sided.canExtractItem(i, stack, 0))) { + found = true; + + for(int j = indices[0]; j <= indices[1]; j++) { + + if(slots[j] != null && slots[j].stackSize < slots[j].getMaxStackSize() & InventoryUtil.doesStackDataMatch(slots[j], stack)) { + inv.decrStackSize(i, 1); + slots[j].stackSize++; + continue outer; + } } - } - - for(int j = indices[0]; j <= indices[1]; j++) { - - if(slots[j] == null) { - slots[j] = stack.copy(); - slots[j].stackSize = 1; - inv.decrStackSize(i, 1); - return; + + for(int j = indices[0]; j <= indices[1]; j++) { + + if(slots[j] == null) { + slots[j] = stack.copy(); + slots[j].stackSize = 1; + inv.decrStackSize(i, 1); + continue outer; + } } } } + + if(!found) return; } } } @@ -209,8 +236,13 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa IInventory inv = (IInventory) te; int i = indices[2]; - ItemStack out = slots[i]; + + int template = getTemplateIndex(index); + if(this.needsTemplateSwitch[index] && te instanceof TileEntityCrateTemplate && slots[template] != null) { + out = slots[template]; + i = template; + } if(out != null) { @@ -266,4 +298,5 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa public abstract int[] getSlotIndicesFromIndex(int index); public abstract ChunkCoordinates[] getInputPositions(); public abstract ChunkCoordinates[] getOutputPositions(); + public abstract int getPowerSlot(); } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemfac.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemfac.java index 8a7c4e55f..a7f8b6f1e 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemfac.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemfac.java @@ -1,21 +1,15 @@ package com.hbm.tileentity.machine; -import java.util.ArrayList; -import java.util.List; import java.util.Random; import com.hbm.blocks.BlockDummyable; -import com.hbm.interfaces.IFluidAcceptor; -import com.hbm.interfaces.IFluidSource; import com.hbm.inventory.UpgradeManager; import com.hbm.inventory.container.ContainerAssemfac; -import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.gui.GUIAssemfac; import com.hbm.items.machine.ItemMachineUpgrade; import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; -import com.hbm.lib.Library; import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.fluid.IFluidStandardTransceiver; @@ -31,7 +25,7 @@ import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase implements IFluidStandardTransceiver, IFluidAcceptor, IFluidSource { +public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase implements IFluidStandardTransceiver { public AssemblerArm[] arms; @@ -46,8 +40,8 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im arms[i] = new AssemblerArm(i % 3 == 1 ? 1 : 0); //the second of every group of three becomes a welder } - water = new FluidTank(Fluids.WATER, 64_000, 0); - steam = new FluidTank(Fluids.SPENTSTEAM, 64_000, 1); + water = new FluidTank(Fluids.WATER, 64_000); + steam = new FluidTank(Fluids.SPENTSTEAM, 64_000); } @Override @@ -94,10 +88,6 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im this.sendFluid(steam, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - if(steam.getFill() > 0) { - this.fillFluidInit(steam.getTankType()); - } - NBTTagCompound data = new NBTTagCompound(); data.setLong("power", this.power); data.setIntArray("progress", this.progress); @@ -402,6 +392,11 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im return outpos; } + @Override + public int getPowerSlot() { + return 0; + } + @Override public FluidTank[] getSendingTanks() { return new FluidTank[] { steam }; @@ -412,59 +407,6 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im return new FluidTank[] { water }; } - @Override - public void setFillForSync(int fill, int index) { } - - @Override - public void setFluidFill(int fill, FluidType type) { - if(type == water.getTankType()) water.setFill(fill); - if(type == steam.getTankType()) steam.setFill(fill); - } - - @Override - public void setTypeForSync(FluidType type, int index) { } - - @Override - public int getFluidFill(FluidType type) { - if(type == water.getTankType()) return water.getFill(); - if(type == steam.getTankType()) return steam.getFill(); - return 0; - } - - @Override - public void fillFluidInit(FluidType type) { - for(DirPos pos : getConPos()) { - this.fillFluid(pos.getX(), pos.getY(), pos.getZ(), this.getTact(), type); - } - } - - @Override - public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) { - Library.transmitFluid(x, y, z, newTact, this, worldObj, type); - } - - @Override - public boolean getTact() { - return worldObj.getTotalWorldTime() % 2 == 0; - } - - private List list = new ArrayList(); - - @Override - public List getFluidList(FluidType type) { - return type == steam.getTankType() ? this.list : new ArrayList(); - } - - @Override - public void clearFluidList(FluidType type) { - this.list.clear(); - } - - @Override - public int getMaxFluidFill(FluidType type) { - return type == water.getTankType() ? water.getMaxFill() : 0; - } - @Override public FluidTank[] getAllTanks() { return new FluidTank[] { water, steam }; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java index 8055c8d11..379a95c1b 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java @@ -364,7 +364,10 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements for(AStack ingredient : recipe.inputs) { - if(!InventoryUtil.doesArrayHaveIngredients(slots, 13, 16, ingredient)) { + outer: + while(!InventoryUtil.doesArrayHaveIngredients(slots, 13, 16, ingredient)) { + + boolean found = false; for(int i = 0; i < inv.getSizeInventory(); i++) { @@ -376,7 +379,7 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements if(slots[j] != null && slots[j].stackSize < slots[j].getMaxStackSize() & InventoryUtil.doesStackDataMatch(slots[j], stack)) { inv.decrStackSize(i, 1); slots[j].stackSize++; - return; + continue outer; } } @@ -386,11 +389,13 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements slots[j] = stack.copy(); slots[j].stackSize = 1; inv.decrStackSize(i, 1); - return; + continue outer; } } } } + + if(!found) return; } } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java index 6d6caf6e2..d91102d51 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java @@ -214,7 +214,10 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa for(AStack ingredient : recipe.inputs) { - if(!InventoryUtil.doesArrayHaveIngredients(slots, indices[0], indices[1], ingredient)) { + outer: + while(!InventoryUtil.doesArrayHaveIngredients(slots, indices[0], indices[1], ingredient)) { + + boolean found = false; for(int i = 0; i < inv.getSizeInventory(); i++) { @@ -226,7 +229,7 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa if(slots[j] != null && slots[j].stackSize < slots[j].getMaxStackSize() & InventoryUtil.doesStackDataMatch(slots[j], stack)) { inv.decrStackSize(i, 1); slots[j].stackSize++; - return; + continue outer; } } @@ -236,11 +239,13 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa slots[j] = stack.copy(); slots[j].stackSize = 1; inv.decrStackSize(i, 1); - return; + continue outer; } } } } + + if(!found) return; } } } diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateIron.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateIron.java index aec9bf3f2..23e079344 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateIron.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateIron.java @@ -31,6 +31,4 @@ public class TileEntityCrateIron extends TileEntityCrateBase { public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUICrateIron(player.inventory, this); } - - } diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateSteel.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateSteel.java index 940f689c6..abb9cf0cb 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateSteel.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateSteel.java @@ -8,10 +8,9 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; -import net.minecraft.inventory.ISidedInventory; import net.minecraft.world.World; -public class TileEntityCrateSteel extends TileEntityCrateBase implements ISidedInventory { +public class TileEntityCrateSteel extends TileEntityCrateBase { public TileEntityCrateSteel() { super(54); diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateTemplate.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateTemplate.java new file mode 100644 index 000000000..c22a6e669 --- /dev/null +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateTemplate.java @@ -0,0 +1,34 @@ +package com.hbm.tileentity.machine.storage; + +import com.hbm.inventory.container.ContainerCrateTemplate; +import com.hbm.inventory.gui.GUICrateTemplate; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.world.World; + +public class TileEntityCrateTemplate extends TileEntityCrateBase { + + public TileEntityCrateTemplate() { + super(27); + } + + @Override + public String getInventoryName() { + return this.hasCustomInventoryName() ? this.customName : "container.crateTemplate"; + } + + @Override + public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { + return new ContainerCrateTemplate(player.inventory, this); + } + + @Override + @SideOnly(Side.CLIENT) + public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { + return new GUICrateTemplate(player.inventory, this); + } +} diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java index b8217f1d3..62580710e 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java @@ -10,7 +10,7 @@ import com.hbm.entity.logic.EntityBomber; import com.hbm.entity.missile.EntityMissileBaseAdvanced; import com.hbm.entity.missile.EntityMissileCustom; import com.hbm.entity.missile.EntitySiegeDropship; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.entity.train.EntityRailCarBase; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; @@ -356,7 +356,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple vec.rotateAroundZ((float) -this.rotationPitch); vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5)); - EntityBulletBase proj = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.getKey(bullet)); + EntityBulletBaseNT proj = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.getKey(bullet)); proj.setPositionAndRotation(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord, 0.0F, 0.0F); proj.setThrowableHeading(vec.xCoord, vec.yCoord, vec.zCoord, bullet.velocity, bullet.spread); diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java index 3121134f9..01a63ffab 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; import com.hbm.blocks.BlockDummyable; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; import com.hbm.interfaces.IFluidAcceptor; @@ -113,7 +113,7 @@ public class TileEntityTurretFritz extends TileEntityTurretBaseNT implements IFl vec.rotateAroundZ((float) -this.rotationPitch); vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5)); - EntityBulletBase proj = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.getKey(conf)); + EntityBulletBaseNT proj = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.getKey(conf)); proj.setPositionAndRotation(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord, 0.0F, 0.0F); proj.overrideDamage = (float) (trait.getHeatEnergy() / 500_000F); diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretRichard.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretRichard.java index c23f2595e..f6c95d847 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretRichard.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretRichard.java @@ -3,7 +3,7 @@ package com.hbm.tileentity.turret; import java.util.ArrayList; import java.util.List; -import com.hbm.entity.projectile.EntityBulletBase; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; import com.hbm.inventory.RecipesCommon.ComparableStack; @@ -155,7 +155,7 @@ public class TileEntityTurretRichard extends TileEntityTurretBaseNT { vec.rotateAroundZ((float) -this.rotationPitch); vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5)); - EntityBulletBase proj = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.getKey(bullet)); + EntityBulletBaseNT proj = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.getKey(bullet)); proj.setPositionAndRotation(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord, 0.0F, 0.0F); proj.setThrowableHeading(vec.xCoord, vec.yCoord, vec.zCoord, bullet.velocity * 0.75F, bullet.spread); diff --git a/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java b/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java index 0337af69a..a672e32a3 100644 --- a/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java +++ b/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java @@ -2,8 +2,6 @@ package com.hbm.world.gen; import java.util.Random; -import com.hbm.blocks.ModBlocks; -import com.hbm.blocks.generic.BlockNTMFlower.EnumFlowerType; import com.hbm.config.StructureConfig; import cpw.mods.fml.common.IWorldGenerator; @@ -13,7 +11,6 @@ import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.IChunkProvider; import static net.minecraftforge.common.BiomeDictionary.*; -import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate; import net.minecraftforge.event.terraingen.InitMapGenEvent.EventType; import net.minecraftforge.event.terraingen.PopulateChunkEvent; import static net.minecraftforge.event.terraingen.TerrainGen.*; diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 544d8c28f..d7e063169 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -293,6 +293,7 @@ container.craneUnboxer=Förderband-Entpacker container.crateDesh=Deshkiste container.crateIron=Eisenkiste container.crateSteel=Stahlkiste +container.crateTemplate=Vorlagenkiste container.crateTungsten=Wolframkiste container.crystallizer=Erzauflöser container.cyclotron=Zyklotron @@ -982,6 +983,9 @@ item.ammo_arty_phosgene.name=16" Artilleriegranate (Phosgen) item.ammo_arty_phosphorus.name=16" Phosphor-Artilleriegranate item.ammo_arty_phosphorus_multi.name=16" Mehrfach-Phosphor-Artilleriegranate item.ammo_cell.name=Energiezelle +item.ammo_coilgun.name=Wolframkugel +item.ammo_coilgun_du.name=Ferrourankugel +item.ammo_coilgun_rubber.name=Gummikugel item.ammo_container.name=Munitionsbehälter item.ammo_dart.name=Plastikdart (Withernd) item.ammo_dart_nerf.name=NERF-Dart @@ -1875,7 +1879,6 @@ item.gun_calamity_ammo.name=.50 BMG Patrone (LEGACY) item.gun_calamity_dual.name=Sattelkanone item.gun_chemthrower.name=Chemowerfer item.gun_coilgun.name=Gaußpistole -item.gun_coilgun_ammo.name=Wolframkugel item.gun_cryolator.name=Der Cryolator item.gun_cryolator_ammo.name=Kryozelle item.gun_dampfmaschine.name=Garantiert keine Scherzwaffe @@ -3715,6 +3718,7 @@ tile.crate_lead.name=Gefahrenstoffkiste tile.crate_metal.name=Maschinenkiste tile.crate_red.name=Rote Kiste tile.crate_steel.name=Stahlkiste +tile.crate_template.name=Vorlagenkiste tile.crate_tungsten.name=Wolframkiste tile.crate_weapon.name=Waffenkiste tile.crystal_hardened.name=Gehärteter Dunkler Kristall diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index b56c75ce4..e879e685e 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -629,6 +629,7 @@ container.craneUnboxer=Conveyor Unboxer container.crateDesh=Desh Crate container.crateIron=Iron Crate container.crateSteel=Steel Crate +container.crateTemplate=Template Crate container.crateTungsten=Tungsten Crate container.crystallizer=Ore Acidizer container.cyclotron=Cyclotron @@ -1609,6 +1610,9 @@ item.ammo_arty_phosgene.name=16" Phosgene Artillery Shell item.ammo_arty_phosphorus.name=16" Phosphorus Shell item.ammo_arty_phosphorus_multi.name=16" Multi Phosphorus Shell item.ammo_cell.name=Energy Cell +item.ammo_coilgun.name=Coilgun Tungsten Ball +item.ammo_coilgun_du.name=Coilgun Ferrouranium Ball +item.ammo_coilgun_rubber.name=Coilgun Rubber Ball item.ammo_container.name=Ammo Container item.ammo_dart.name=Plastic Dart (Withering) item.ammo_dart_nerf.name=NERF Dart @@ -2567,7 +2571,6 @@ item.gun_calamity_ammo.name=.50 BMG Round (LEGACY) item.gun_calamity_dual.name=Saddle Gun item.gun_chemthrower.name=Chemthrower item.gun_coilgun.name=Coilgun -item.gun_coilgun_ammo.name=Coilgun Tungsten Ball item.gun_cryolator.name=The Cryolator item.gun_cryolator_ammo.name=Cryo Cell item.gun_dampfmaschine.name=Totally Not a Joke Weapon @@ -4591,6 +4594,7 @@ tile.crate_lead.name=Hazmat Crate tile.crate_metal.name=Machine Crate tile.crate_red.name=Red Crate tile.crate_steel.name=Steel Crate +tile.crate_template.name=Template Crate tile.crate_tungsten.name=Tungsten Crate tile.crate_weapon.name=Weapon Crate tile.crystal_hardened.name=Hardened Dark Crystal diff --git a/src/main/resources/assets/hbm/textures/blocks/crate_template.png b/src/main/resources/assets/hbm/textures/blocks/crate_template.png new file mode 100644 index 000000000..2ae4399fc Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/crate_template.png differ diff --git a/src/main/resources/assets/hbm/textures/gui/fluids/hotblood.png b/src/main/resources/assets/hbm/textures/gui/fluids/blood_hot.png similarity index 100% rename from src/main/resources/assets/hbm/textures/gui/fluids/hotblood.png rename to src/main/resources/assets/hbm/textures/gui/fluids/blood_hot.png diff --git a/src/main/resources/assets/hbm/textures/gui/storage/gui_crate_template.png b/src/main/resources/assets/hbm/textures/gui/storage/gui_crate_template.png new file mode 100644 index 000000000..c82ad403b Binary files /dev/null and b/src/main/resources/assets/hbm/textures/gui/storage/gui_crate_template.png differ diff --git a/src/main/resources/assets/hbm/textures/items/gun_coilgun_ammo.png b/src/main/resources/assets/hbm/textures/items/ammo_coilgun.png similarity index 100% rename from src/main/resources/assets/hbm/textures/items/gun_coilgun_ammo.png rename to src/main/resources/assets/hbm/textures/items/ammo_coilgun.png diff --git a/src/main/resources/assets/hbm/textures/items/ammo_coilgun_du.png b/src/main/resources/assets/hbm/textures/items/ammo_coilgun_du.png new file mode 100644 index 000000000..a8bb6196c Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/ammo_coilgun_du.png differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_coilgun_rubber.png b/src/main/resources/assets/hbm/textures/items/ammo_coilgun_rubber.png new file mode 100644 index 000000000..265c2b866 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/ammo_coilgun_rubber.png differ