mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
spent casings for turrets, finished 12ga percussive caps
This commit is contained in:
parent
5075f28bc2
commit
00e8675a15
@ -251,6 +251,10 @@ public class EntityBulletBase extends Entity implements IProjectile {
|
||||
}
|
||||
|
||||
if(config.maxAge == 0) {
|
||||
|
||||
if(this.config.bUpdate != null)
|
||||
this.config.bUpdate.behaveUpdate(this);
|
||||
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ 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;
|
||||
@ -110,14 +111,7 @@ public class Gun12GaugeFactory {
|
||||
config.firingSound = "hbm:weapon.shotgunPump";
|
||||
config.reloadType = GunConfiguration.RELOAD_SINGLE;
|
||||
|
||||
|
||||
config.config = new ArrayList<Integer>();
|
||||
config.config.add(BulletConfigSyncingUtil.G12_NORMAL);
|
||||
config.config.add(BulletConfigSyncingUtil.G12_INCENDIARY);
|
||||
config.config.add(BulletConfigSyncingUtil.G12_SHRAPNEL);
|
||||
config.config.add(BulletConfigSyncingUtil.G12_DU);
|
||||
config.config.add(BulletConfigSyncingUtil.G12_AM);
|
||||
config.config.add(BulletConfigSyncingUtil.G12_SLEEK);
|
||||
config.config = HbmCollection.twelveGauge;
|
||||
|
||||
config.ejector = EJECTOR_SPAS_ALT;
|
||||
|
||||
@ -305,43 +299,50 @@ public class Gun12GaugeFactory {
|
||||
|
||||
public static BulletConfiguration get12GaugePercussionConfig() {
|
||||
|
||||
BulletConfiguration bullet = new BulletConfiguration();
|
||||
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
|
||||
|
||||
bullet.ammo = new ComparableStack(ModItems.ammo_12gauge.stackFromEnum(Ammo12Gauge.PERCUSSION));
|
||||
bullet.velocity = 2F;
|
||||
bullet.spread = 0F;
|
||||
bullet.spentCasing = CASING12GAUGE.clone().register("12GaPerc").setColor(0x9E1616, SpentCasing.COLOR_CASE_12GA);
|
||||
|
||||
bullet.wear = 10;
|
||||
bullet.dmgMin = 30F;
|
||||
bullet.dmgMax = 30F;
|
||||
bullet.maxAge = 0;
|
||||
|
||||
bullet.spentCasing = CASING12GAUGE.clone().register("12GaPerc").setColor(0x9E1616, SpentCasing.COLOR_CASE_12GA);
|
||||
|
||||
bullet.bUpdate = (entityBullet) -> {
|
||||
bullet.bUpdate = new IBulletUpdateBehavior() {
|
||||
|
||||
if(!entityBullet.worldObj.isRemote) {
|
||||
@Override
|
||||
public void behaveUpdate(EntityBulletBase bullet) {
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(entityBullet.motionX, entityBullet.motionY, entityBullet.motionZ);
|
||||
double radius = vec.lengthVector();
|
||||
double x = entityBullet.posX + vec.xCoord;
|
||||
double y = entityBullet.posY + vec.yCoord;
|
||||
double z = entityBullet.posZ + vec.zCoord;
|
||||
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(x, y, z, x, y, z).expand(radius, radius, radius);
|
||||
List<Entity> list = entityBullet.worldObj.getEntitiesWithinAABBExcludingEntity(entityBullet.shooter, aabb);
|
||||
|
||||
for(Entity e : list) {
|
||||
DamageSource source = entityBullet.shooter instanceof EntityPlayer ? DamageSource.causePlayerDamage((EntityPlayer) entityBullet.shooter) : DamageSource.magic;
|
||||
e.attackEntityFrom(source, 30F);
|
||||
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<Entity> 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();
|
||||
}
|
||||
|
||||
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) Math.toDegrees(entityBullet.rotationPitch));
|
||||
data.setFloat("yaw", (float) Math.toDegrees(entityBullet.rotationYaw));
|
||||
data.setFloat("scale", 2F);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z),
|
||||
new TargetPoint(entityBullet.dimension, x, y, z, 100));
|
||||
|
||||
entityBullet.setDead();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ public class Gun5mmFactory {
|
||||
|
||||
static {
|
||||
EJECTOR_MINIGUN = new CasingEjector().setMotion(-0.4, 0.1, 0).setOffset(-0.35, -0.2, 0.35).setAngleRange(0.01F, 0.03F).setAmount(5);
|
||||
CASING5MM = new SpentCasing(CasingType.STRAIGHT).setScale(1F).setBounceMotion(0.05F, 0.02F).setColor(SpentCasing.COLOR_CASE_BRASS);
|
||||
CASING5MM = new SpentCasing(CasingType.STRAIGHT).setScale(1.25F).setBounceMotion(0.05F, 0.02F).setColor(SpentCasing.COLOR_CASE_BRASS);
|
||||
}
|
||||
|
||||
public static GunConfiguration getMinigunConfig() {
|
||||
|
||||
@ -6,8 +6,16 @@ import com.hbm.interfaces.IBulletImpactBehavior;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.items.ItemAmmoEnums.Ammo240Shell;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.particle.SpentCasing.CasingType;
|
||||
|
||||
public class GunCannonFactory {
|
||||
|
||||
protected static SpentCasing CASINNG240MM;
|
||||
|
||||
static {
|
||||
CASINNG240MM = new SpentCasing(CasingType.BOTTLENECK).setScale(7.5F).setBounceMotion(0.02F, 0.05F).setColor(SpentCasing.COLOR_CASE_BRASS);
|
||||
}
|
||||
|
||||
public static BulletConfiguration getShellConfig() {
|
||||
|
||||
@ -19,6 +27,8 @@ public class GunCannonFactory {
|
||||
bullet.explosive = 4F;
|
||||
bullet.blockDamage = false;
|
||||
|
||||
bullet.spentCasing = CASINNG240MM.register("240MM"); //same instance everywhere, only register once
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
@ -32,6 +42,8 @@ public class GunCannonFactory {
|
||||
bullet.explosive = 4F;
|
||||
bullet.blockDamage = true;
|
||||
|
||||
bullet.spentCasing = CASINNG240MM;
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
@ -45,6 +57,8 @@ public class GunCannonFactory {
|
||||
bullet.doesPenetrate = true;
|
||||
bullet.style = BulletConfiguration.STYLE_APDS;
|
||||
|
||||
bullet.spentCasing = CASINNG240MM;
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
@ -58,6 +72,8 @@ public class GunCannonFactory {
|
||||
bullet.doesPenetrate = true;
|
||||
bullet.style = BulletConfiguration.STYLE_APDS;
|
||||
|
||||
bullet.spentCasing = CASINNG240MM;
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
@ -77,6 +93,8 @@ public class GunCannonFactory {
|
||||
}
|
||||
};
|
||||
|
||||
bullet.spentCasing = CASINNG240MM;
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
@ -3,13 +3,22 @@ package com.hbm.handler.guncfg;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.particle.SpentCasing.CasingType;
|
||||
|
||||
public class GunDGKFactory {
|
||||
|
||||
public static final SpentCasing CASINGDGK;
|
||||
|
||||
static {
|
||||
CASINGDGK = new SpentCasing(CasingType.STRAIGHT).setScale(1.5F).setBounceMotion(0.05F, 0.02F).setColor(SpentCasing.COLOR_CASE_BRASS).setMaxAge(60); //3 instead of 12 seconds
|
||||
}
|
||||
|
||||
public static BulletConfiguration getDGKConfig() {
|
||||
|
||||
BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig();
|
||||
bullet.ammo = new ComparableStack(ModItems.ammo_dgk);
|
||||
bullet.spentCasing = CASINGDGK.register("DGK");
|
||||
return bullet;
|
||||
}
|
||||
|
||||
|
||||
@ -4432,7 +4432,7 @@ public class ModItems {
|
||||
ammo_folly = new ItemCustomLore().setUnlocalizedName("ammo_folly");
|
||||
ammo_folly_nuclear = new ItemCustomLore().setUnlocalizedName("ammo_folly_nuclear");
|
||||
ammo_folly_du = new ItemCustomLore().setUnlocalizedName("ammo_folly_du");
|
||||
ammo_dgk = new ItemCustomLore().setUnlocalizedName("ammo_dgk");
|
||||
//ammo_dgk = new ItemCustomLore().setUnlocalizedName("ammo_dgk");
|
||||
ammo_arty = new ItemAmmoArty().setUnlocalizedName("ammo_arty");
|
||||
ammo_himars = new ItemAmmoHIMARS().setUnlocalizedName("ammo_himars");
|
||||
/*ammo_nuke = new ItemAmmo().setUnlocalizedName("ammo_nuke");
|
||||
|
||||
@ -20,6 +20,8 @@ import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.particle.SpentCasing.CasingType;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -171,14 +173,16 @@ public class ItemAmmoArty extends Item {
|
||||
return "item." + itemTypes[Math.abs(stack.getItemDamage()) % itemTypes.length].name;
|
||||
}
|
||||
|
||||
protected static SpentCasing SIXTEEN_INCH_CASE = new SpentCasing(CasingType.STRAIGHT).setScale(15F, 15F, 10F);
|
||||
|
||||
public abstract class ArtilleryShell {
|
||||
|
||||
String name;
|
||||
public SpentCasing casing;
|
||||
|
||||
public ArtilleryShell() { }
|
||||
|
||||
public ArtilleryShell(String name) {
|
||||
public ArtilleryShell(String name, int casingColor) {
|
||||
this.name = name;
|
||||
this.casing = SIXTEEN_INCH_CASE.clone().register(name).setColor(casingColor);
|
||||
}
|
||||
|
||||
public abstract void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop);
|
||||
@ -231,12 +235,12 @@ public class ItemAmmoArty extends Item {
|
||||
|
||||
private void init() {
|
||||
/* STANDARD SHELLS */
|
||||
this.itemTypes[NORMAL] = new ArtilleryShell("ammo_arty") { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 10F, 3F, false); }};
|
||||
this.itemTypes[CLASSIC] = new ArtilleryShell("ammo_arty_classic") { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 15F, 5F, false); }};
|
||||
this.itemTypes[EXPLOSIVE] = new ArtilleryShell("ammo_arty_he") { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 15F, 3F, true); }};
|
||||
this.itemTypes[NORMAL] = new ArtilleryShell("ammo_arty", SpentCasing.COLOR_CASE_16INCH) { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 10F, 3F, false); }};
|
||||
this.itemTypes[CLASSIC] = new ArtilleryShell("ammo_arty_classic", SpentCasing.COLOR_CASE_16INCH) { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 15F, 5F, false); }};
|
||||
this.itemTypes[EXPLOSIVE] = new ArtilleryShell("ammo_arty_he", SpentCasing.COLOR_CASE_16INCH) { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 15F, 3F, true); }};
|
||||
|
||||
/* MINI NUKE */
|
||||
this.itemTypes[MINI_NUKE] = new ArtilleryShell("ammo_arty_mini_nuke") {
|
||||
this.itemTypes[MINI_NUKE] = new ArtilleryShell("ammo_arty_mini_nuke", SpentCasing.COLOR_CASE_16INCH_NUKE) {
|
||||
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||
shell.killAndClear();
|
||||
Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize();
|
||||
@ -245,7 +249,7 @@ public class ItemAmmoArty extends Item {
|
||||
};
|
||||
|
||||
/* FULL NUKE */
|
||||
this.itemTypes[NUKE] = new ArtilleryShell("ammo_arty_nuke") {
|
||||
this.itemTypes[NUKE] = new ArtilleryShell("ammo_arty_nuke", SpentCasing.COLOR_CASE_16INCH_NUKE) {
|
||||
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||
shell.worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(shell.worldObj, BombConfig.missileRadius, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord));
|
||||
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(shell.worldObj, 1000, BombConfig.missileRadius * 0.005F);
|
||||
@ -258,7 +262,7 @@ public class ItemAmmoArty extends Item {
|
||||
};
|
||||
|
||||
/* PHOSPHORUS */
|
||||
this.itemTypes[PHOSPHORUS] = new ArtilleryShell("ammo_arty_phosphorus") {
|
||||
this.itemTypes[PHOSPHORUS] = new ArtilleryShell("ammo_arty_phosphorus", SpentCasing.COLOR_CASE_16INCH_PHOS) {
|
||||
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||
standardExplosion(shell, mop, 10F, 3F, false);
|
||||
shell.worldObj.playSoundEffect(shell.posX, shell.posY, shell.posZ, "hbm:weapon.explosionMedium", 20.0F, 0.9F + shell.worldObj.rand.nextFloat() * 0.2F);
|
||||
@ -287,7 +291,7 @@ public class ItemAmmoArty extends Item {
|
||||
};
|
||||
|
||||
/* THIS DOOFUS */
|
||||
this.itemTypes[CARGO] = new ArtilleryShell("ammo_arty_cargo") { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||
this.itemTypes[CARGO] = new ArtilleryShell("ammo_arty_cargo", SpentCasing.COLOR_CASE_16INCH) { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||
if(mop.typeOfHit == MovingObjectType.BLOCK) {
|
||||
shell.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||
shell.getStuck(mop.blockX, mop.blockY, mop.blockZ);
|
||||
@ -295,11 +299,11 @@ public class ItemAmmoArty extends Item {
|
||||
}};
|
||||
|
||||
/* CLUSTER SHELLS */
|
||||
this.itemTypes[PHOSPHORUS_MULTI] = new ArtilleryShell("ammo_arty_phosphorus_multi") {
|
||||
this.itemTypes[PHOSPHORUS_MULTI] = new ArtilleryShell("ammo_arty_phosphorus_multi", SpentCasing.COLOR_CASE_16INCH_PHOS) {
|
||||
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { ItemAmmoArty.this.itemTypes[PHOSPHORUS].onImpact(shell, mop); }
|
||||
public void onUpdate(EntityArtilleryShell shell) { standardCluster(shell, PHOSPHORUS, 10, 300, 5); }
|
||||
};
|
||||
this.itemTypes[MINI_NUKE_MULTI] = new ArtilleryShell("ammo_arty_mini_nuke_multi") {
|
||||
this.itemTypes[MINI_NUKE_MULTI] = new ArtilleryShell("ammo_arty_mini_nuke_multi", SpentCasing.COLOR_CASE_16INCH_NUKE) {
|
||||
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { ItemAmmoArty.this.itemTypes[MINI_NUKE].onImpact(shell, mop); }
|
||||
public void onUpdate(EntityArtilleryShell shell) { standardCluster(shell, MINI_NUKE, 5, 300, 5); }
|
||||
};
|
||||
|
||||
@ -25,8 +25,8 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ParticleSpentCasing extends EntityFX
|
||||
{
|
||||
public class ParticleSpentCasing extends EntityFX {
|
||||
|
||||
public static final Random rand = new Random();
|
||||
private static float dScale = 0.05F, smokeJitter = 0.025F, smokeAccel = 0.5F;
|
||||
private static byte maxSmokeGen = 60, maxSmokeLife = 120;
|
||||
@ -49,7 +49,7 @@ public class ParticleSpentCasing extends EntityFX
|
||||
this.momentumYaw = momentumYaw;
|
||||
this.config = config;
|
||||
|
||||
particleMaxAge = 240;
|
||||
particleMaxAge = config.getMaxAge();
|
||||
smoke = rand.nextFloat() < config.getSmokeChance();
|
||||
|
||||
motionX = mx;
|
||||
|
||||
@ -12,6 +12,9 @@ public class SpentCasing implements Cloneable {
|
||||
public static final int COLOR_CASE_12GA = 0x757575;
|
||||
public static final int COLOR_CASE_4GA = 0xD8D8D8;
|
||||
public static final int COLOR_CASE_44 = 0x3E3E3E;
|
||||
public static final int COLOR_CASE_16INCH = 0xD89128;
|
||||
public static final int COLOR_CASE_16INCH_PHOS = 0xC8C8C8;
|
||||
public static final int COLOR_CASE_16INCH_NUKE = 0x495443;
|
||||
|
||||
public static final HashMap<String, SpentCasing> casingMap = new HashMap();
|
||||
|
||||
@ -38,6 +41,7 @@ public class SpentCasing implements Cloneable {
|
||||
private float smokeChance;
|
||||
private float bounceYaw = 0F;
|
||||
private float bouncePitch = 0F;
|
||||
private int maxAge = 240;
|
||||
|
||||
public SpentCasing(CasingType type) {
|
||||
this.type = type;
|
||||
@ -89,6 +93,11 @@ public class SpentCasing implements Cloneable {
|
||||
this.bouncePitch = pitch;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SpentCasing setMaxAge(int age) {
|
||||
this.maxAge = age;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() { return this.registryName; }
|
||||
public float getScaleX() { return this.scaleX; }
|
||||
@ -100,6 +109,7 @@ public class SpentCasing implements Cloneable {
|
||||
public float getSmokeChance() { return this.smokeChance; }
|
||||
public float getBounceYaw() { return this.bounceYaw; }
|
||||
public float getBouncePitch() { return this.bouncePitch; }
|
||||
public int getMaxAge() { return this.maxAge; }
|
||||
|
||||
@Override
|
||||
public SpentCasing clone() {
|
||||
|
||||
@ -5,9 +5,11 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.entity.projectile.EntityArtilleryShell;
|
||||
import com.hbm.handler.CasingEjector;
|
||||
import com.hbm.inventory.container.ContainerTurretBase;
|
||||
import com.hbm.inventory.gui.GUITurretArty;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.weapon.ItemAmmoArty;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
@ -210,6 +212,13 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen
|
||||
proj.setWhistle(true);
|
||||
|
||||
worldObj.spawnEntityInWorld(proj);
|
||||
|
||||
casingDelay = this.casingDelay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int casingDelay() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
protected void updateConnections() {
|
||||
@ -333,6 +342,12 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen
|
||||
|
||||
this.didJustShoot = false;
|
||||
|
||||
if(casingDelay > 0) {
|
||||
casingDelay--;
|
||||
} else {
|
||||
spawnCasing();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(this.getBarrelLength(), 0, 0);
|
||||
@ -364,6 +379,7 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen
|
||||
ItemStack conf = this.getShellLoaded();
|
||||
|
||||
if(conf != null) {
|
||||
cachedCasingConfig = ItemAmmoArty.itemTypes[conf.getItemDamage()].casing;
|
||||
this.spawnShell(conf);
|
||||
this.conusmeAmmo(ModItems.ammo_arty);
|
||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:turret.jeremy_fire", 25.0F, 1.0F);
|
||||
@ -388,6 +404,18 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen
|
||||
}
|
||||
}
|
||||
|
||||
protected static CasingEjector ejector = new CasingEjector().setMotion(0, 1.2, 0.5).setAngleRange(0.1F, 0.1F);
|
||||
|
||||
@Override
|
||||
protected CasingEjector getEjector() {
|
||||
return ejector;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Vec3 getCasingSpawnPos() {
|
||||
return this.getTurretPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleButtonPacket(int value, int meta) {
|
||||
if(meta == 5) {
|
||||
|
||||
@ -12,16 +12,20 @@ import com.hbm.entity.missile.EntitySiegeDropship;
|
||||
import com.hbm.entity.projectile.EntityBulletBase;
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.handler.CasingEjector;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemTurretBiometry;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.Entity;
|
||||
@ -216,6 +220,14 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
||||
NBTTagCompound data = this.writePacket();
|
||||
this.networkPack(data, 250);
|
||||
|
||||
if(usesCasings() && this.casingDelay() > 0) {
|
||||
if(casingDelay > 0) {
|
||||
casingDelay--;
|
||||
} else {
|
||||
spawnCasing();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(this.getBarrelLength(), 0, 0);
|
||||
@ -230,14 +242,6 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
||||
else
|
||||
this.lastRotationYaw -= Math.PI * 2;
|
||||
}
|
||||
|
||||
if(usesCasings() && this.casingDelay() > 0) {
|
||||
if(casingDelay > 0) {
|
||||
casingDelay--;
|
||||
} else {
|
||||
spawnCasing();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -353,10 +357,11 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
||||
worldObj.spawnEntityInWorld(proj);
|
||||
|
||||
if(usesCasings()) {
|
||||
if(this.casingDelay() == 0)
|
||||
if(this.casingDelay() == 0) {
|
||||
spawnCasing();
|
||||
else
|
||||
} else {
|
||||
casingDelay = this.casingDelay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -846,20 +851,25 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
||||
return this.getTurretPos();
|
||||
}
|
||||
|
||||
protected CasingEjector getEjector() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void spawnCasing() {
|
||||
|
||||
if(cachedCasingConfig == null) return;
|
||||
CasingEjector ej = getEjector();
|
||||
|
||||
Vec3 spawn = this.getCasingSpawnPos();
|
||||
final NBTTagCompound data = new NBTTagCompound();
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "casing");
|
||||
data.setDouble("posX", spawn.xCoord);
|
||||
data.setDouble("posY", spawn.yCoord);
|
||||
data.setDouble("posZ", spawn.zCoord);
|
||||
data.setFloat("pitch", (float) rotationPitch);
|
||||
data.setFloat("yaw", (float) rotationYaw);
|
||||
data.setBoolean("crouched", false);
|
||||
data.setString("name", cachedCasingConfig.getName());
|
||||
MainRegistry.proxy.effectNT(data);
|
||||
if(ej != null) data.setInteger("ej", ej.getId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, spawn.xCoord, spawn.yCoord, spawn.zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
|
||||
cachedCasingConfig = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.handler.CasingEjector;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
@ -73,6 +74,7 @@ public class TileEntityTurretChekhov extends TileEntityTurretBaseNT {
|
||||
BulletConfiguration conf = this.getFirstConfigLoaded();
|
||||
|
||||
if(conf != null) {
|
||||
this.cachedCasingConfig = conf.spentCasing;
|
||||
this.spawnBullet(conf);
|
||||
this.conusmeAmmo(conf.ammo);
|
||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:turret.chekhov_fire", 2.0F, 1.0F);
|
||||
@ -91,6 +93,24 @@ public class TileEntityTurretChekhov extends TileEntityTurretBaseNT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Vec3 getCasingSpawnPos() {
|
||||
|
||||
Vec3 pos = this.getTurretPos();
|
||||
Vec3 vec = Vec3.createVectorHelper(-1.125, 0.125, 0.25);
|
||||
vec.rotateAroundZ((float) -this.rotationPitch);
|
||||
vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
|
||||
|
||||
return Vec3.createVectorHelper(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord);
|
||||
}
|
||||
|
||||
protected static CasingEjector ejector = new CasingEjector().setMotion(-0.8, 0.8, 0).setAngleRange(0.1F, 0.1F);
|
||||
|
||||
@Override
|
||||
protected CasingEjector getEjector() {
|
||||
return ejector;
|
||||
}
|
||||
|
||||
public int getDelay() {
|
||||
return 2;
|
||||
@ -139,7 +159,11 @@ public class TileEntityTurretChekhov extends TileEntityTurretBaseNT {
|
||||
|
||||
@Override
|
||||
public void manualSetup() {
|
||||
|
||||
manual = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesCasings() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.handler.CasingEjector;
|
||||
|
||||
public class TileEntityTurretFriendly extends TileEntityTurretChekhov {
|
||||
|
||||
@ -31,4 +32,11 @@ public class TileEntityTurretFriendly extends TileEntityTurretChekhov {
|
||||
public int getDelay() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
protected static CasingEjector ejector = new CasingEjector().setMotion(-0.3, 0.6, 0).setAngleRange(0.02F, 0.05F);
|
||||
|
||||
@Override
|
||||
protected CasingEjector getEjector() {
|
||||
return ejector;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,9 +6,12 @@ import java.util.List;
|
||||
import com.hbm.config.WeaponConfig;
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.handler.CasingEjector;
|
||||
import com.hbm.handler.guncfg.GunDGKFactory;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.util.EntityDamageUtil;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
@ -126,9 +129,16 @@ public class TileEntityTurretHoward extends TileEntityTurretBaseNT {
|
||||
|
||||
if(loaded > 0 && this.tPos != null) {
|
||||
|
||||
SpentCasing cfg = GunDGKFactory.CASINGDGK;
|
||||
|
||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:turret.howard_fire", 4.0F, 0.9F + worldObj.rand.nextFloat() * 0.3F);
|
||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:turret.howard_fire", 4.0F, 1F + worldObj.rand.nextFloat() * 0.3F);
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
this.cachedCasingConfig = cfg;
|
||||
this.spawnCasing();
|
||||
}
|
||||
|
||||
if(timer % 2 == 0) {
|
||||
loaded--;
|
||||
|
||||
@ -174,4 +184,27 @@ public class TileEntityTurretHoward extends TileEntityTurretBaseNT {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("loaded", loaded);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Vec3 getCasingSpawnPos() {
|
||||
|
||||
Vec3 pos = this.getTurretPos();
|
||||
Vec3 vec = Vec3.createVectorHelper(-0.875, 0.2, -0.125);
|
||||
vec.rotateAroundZ((float) -this.rotationPitch);
|
||||
vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
|
||||
|
||||
return Vec3.createVectorHelper(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord);
|
||||
}
|
||||
|
||||
protected static CasingEjector ejector = new CasingEjector().setAngleRange(0.01F, 0.01F).setMotion(0, 0, -0.1);
|
||||
|
||||
@Override
|
||||
protected CasingEjector getEjector() {
|
||||
return ejector.setMotion(0.4, 0, 0).setAngleRange(0.02F, 0.03F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesCasings() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.hbm.tileentity.turret;
|
||||
|
||||
import com.hbm.config.WeaponConfig;
|
||||
import com.hbm.handler.guncfg.GunDGKFactory;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
@ -70,6 +71,9 @@ public class TileEntityTurretHowardDamaged extends TileEntityTurretHoward {
|
||||
|
||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:turret.howard_fire", 4.0F, 0.7F + worldObj.rand.nextFloat() * 0.3F);
|
||||
|
||||
this.cachedCasingConfig = GunDGKFactory.CASINGDGK;
|
||||
this.spawnCasing();
|
||||
|
||||
if(worldObj.rand.nextInt(100) + 1 <= WeaponConfig.ciwsHitrate * 0.5)
|
||||
EntityDamageUtil.attackEntityFromIgnoreIFrame(this.target, ModDamageSource.shrapnel, 2F + worldObj.rand.nextInt(2));
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.handler.CasingEjector;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
@ -84,6 +85,7 @@ public class TileEntityTurretJeremy extends TileEntityTurretBaseNT {
|
||||
BulletConfiguration conf = this.getFirstConfigLoaded();
|
||||
|
||||
if(conf != null) {
|
||||
this.cachedCasingConfig = conf.spentCasing;
|
||||
this.spawnBullet(conf);
|
||||
this.conusmeAmmo(conf.ammo);
|
||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:turret.jeremy_fire", 4.0F, 1.0F);
|
||||
@ -103,4 +105,32 @@ public class TileEntityTurretJeremy extends TileEntityTurretBaseNT {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Vec3 getCasingSpawnPos() {
|
||||
|
||||
Vec3 pos = this.getTurretPos();
|
||||
Vec3 vec = Vec3.createVectorHelper(-2, 0, 0);
|
||||
vec.rotateAroundZ((float) -this.rotationPitch);
|
||||
vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
|
||||
|
||||
return Vec3.createVectorHelper(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord);
|
||||
}
|
||||
|
||||
protected static CasingEjector ejector = new CasingEjector().setAngleRange(0.01F, 0.01F).setMotion(0, 0, -0.1);
|
||||
|
||||
@Override
|
||||
protected CasingEjector getEjector() {
|
||||
return ejector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesCasings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int casingDelay() {
|
||||
return 22;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.handler.CasingEjector;
|
||||
import com.hbm.inventory.container.ContainerTurretBase;
|
||||
import com.hbm.inventory.gui.GUITurretSentry;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
@ -164,6 +165,7 @@ public class TileEntityTurretSentry extends TileEntityTurretBaseNT implements IG
|
||||
BulletConfiguration conf = this.getFirstConfigLoaded();
|
||||
|
||||
if(conf != null) {
|
||||
this.cachedCasingConfig = conf.spentCasing;
|
||||
this.spawnBullet(conf);
|
||||
this.conusmeAmmo(conf.ammo);
|
||||
this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:turret.sentry_fire", 2.0F, 1.0F);
|
||||
@ -192,6 +194,29 @@ public class TileEntityTurretSentry extends TileEntityTurretBaseNT implements IG
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Vec3 getCasingSpawnPos() {
|
||||
|
||||
Vec3 pos = this.getTurretPos();
|
||||
Vec3 vec = Vec3.createVectorHelper(0, 0.25,-0.125);
|
||||
vec.rotateAroundZ((float) -this.rotationPitch);
|
||||
vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
|
||||
|
||||
return Vec3.createVectorHelper(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord);
|
||||
}
|
||||
|
||||
protected static CasingEjector ejector = new CasingEjector().setMotion(-0.3, 0.6, 0).setAngleRange(0.01F, 0.01F);
|
||||
|
||||
@Override
|
||||
protected CasingEjector getEjector() {
|
||||
return ejector.setMotion(0.3, 0.6, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesCasings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void seekNewTarget() {
|
||||
|
||||
@ -789,6 +789,7 @@ item.ammo_12gauge.name=Kaliber 12 Schrot
|
||||
item.ammo_12gauge_du.name=Kaliber 12 Schrot (Uranbeschichtung)
|
||||
item.ammo_12gauge_incendiary.name=Kaliber 12 Schrot (Brand)
|
||||
item.ammo_12gauge_marauder.name=Kaliber 12 Taktische Anti-Marauder Schrotpatrone
|
||||
item.ammo_12gauge_percussion.name=Kaliber 12 Sprengkapsel
|
||||
item.ammo_12gauge_shrapnel.name=Kaliber 12 Schrot (Schrapnell)
|
||||
item.ammo_12gauge_sleek.name=Kaliber 12 Schrot (IF-F&E)
|
||||
item.ammo_20gauge.name=Kaliber 20 Schrot
|
||||
|
||||
@ -1391,6 +1391,7 @@ item.ammo_12gauge.name=12 Gauge Buckshot
|
||||
item.ammo_12gauge_du.name=12 Gauge Buckshot (Uranium Coated)
|
||||
item.ammo_12gauge_incendiary.name=12 Gauge Buckshot (Incendiary)
|
||||
item.ammo_12gauge_marauder.name=12 Gauge Tactical Anti-Marauder Shell
|
||||
item.ammo_12gauge_percussion.name=12 Gauge Percussion Cap
|
||||
item.ammo_12gauge_shrapnel.name=12 Gauge Buckshot (Shrapnel)
|
||||
item.ammo_12gauge_sleek.name=12 Gauge Buckshot (IF-R&D)
|
||||
item.ammo_20gauge.name=20 Gauge Buckshot
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Loading…
x
Reference in New Issue
Block a user