12 gauge percussive cap, casing spawner for turrets

This commit is contained in:
Boblet 2023-02-03 15:06:05 +01:00
parent f631ec0e9c
commit 5075f28bc2
10 changed files with 113 additions and 9 deletions

View File

@ -186,6 +186,7 @@ public class WeaponRecipes {
CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nopip, 24), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_44, 'P', ModItems.primer_44 });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_12gauge, 12), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ModItems.cordite, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', ModItems.plate_polymer });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_12gauge, 12), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ModItems.ballistite, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', ModItems.plate_polymer });
CraftingManager.addRecipeAuto(ModItems.ammo_12gauge.stackFromEnum(12, Ammo12Gauge.PERCUSSION), new Object[] { "G", "C", "P", 'G', ModItems.ballistite, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_4gauge, 12), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_4gauge, 12), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ModItems.ballistite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer });
CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(12, Ammo4Gauge.SLUG), new Object[] { " I ", "GCL", " P ", 'I', PB.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer });

View File

@ -74,6 +74,7 @@ public class BulletConfigSyncingUtil {
public static int G12_DU = i++;
public static int G12_AM = i++;
public static int G12_SLEEK = i++;
public static int G12_PERCUSSION = i++;
public static int LR22_NORMAL = i++;
public static int LR22_AP = i++;
@ -348,6 +349,7 @@ public class BulletConfigSyncingUtil {
configSet.put(G12_DU, Gun12GaugeFactory.get12GaugeDUConfig());
configSet.put(G12_AM, Gun12GaugeFactory.get12GaugeAMConfig());
configSet.put(G12_SLEEK, Gun12GaugeFactory.get12GaugeSleekConfig());
configSet.put(G12_PERCUSSION, Gun12GaugeFactory.get12GaugePercussionConfig());
configSet.put(LR22_NORMAL, Gun22LRFactory.get22LRConfig());
configSet.put(LR22_AP, Gun22LRFactory.get22LRAPConfig());

View File

@ -1,6 +1,7 @@
package com.hbm.handler.guncfg;
import java.util.ArrayList;
import java.util.List;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.handler.BulletConfigSyncingUtil;
@ -13,6 +14,8 @@ import com.hbm.items.ItemAmmoEnums.Ammo12Gauge;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmCollection;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
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;
@ -22,9 +25,14 @@ import com.hbm.render.anim.BusAnimationSequence;
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.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Vec3;
public class Gun12GaugeFactory {
@ -33,11 +41,11 @@ public class Gun12GaugeFactory {
private static final SpentCasing CASING12GAUGE;
static {
EJECTOR_SPAS = new CasingEjector().setMotion(Vec3.createVectorHelper(-0.4, 0.1, 0)).setOffset(Vec3.createVectorHelper(-0.35, 0, 0.5)).setAngleRange(0.01F, 0.03F).setDelay(10);
EJECTOR_SPAS_ALT = new CasingEjector().setMotion(Vec3.createVectorHelper(-0.4, 0.1, 0)).setOffset(Vec3.createVectorHelper(-0.35, 0, 0.5)).setAngleRange(0.01F, 0.03F).setDelay(10).setAmount(2);
EJECTOR_BENELLI = new CasingEjector().setMotion(Vec3.createVectorHelper(-0.4, 0.1, 0)).setOffset(Vec3.createVectorHelper(-0.3, 1, 0)).setAngleRange(0.01F, 0.03F);
EJECTOR_UBOINIK = new CasingEjector().setMotion(Vec3.createVectorHelper(-0.4, 0.1, 0)).setOffset(Vec3.createVectorHelper(-0.35, -0.3, 0.5)).setAngleRange(0.01F, 0.03F);
EJECTOR_SSG = new CasingEjector().setMotion(Vec3.createVectorHelper(0.2, 0, -0.2)).setOffset(Vec3.createVectorHelper(0.8, 0, 0)).setAngleRange(0.05F, 0.02F).setDelay(20).setAmount(2);
EJECTOR_SPAS = new CasingEjector().setMotion(-0.4, 0.1, 0).setOffset(-0.35, 0, 0.5).setAngleRange(0.01F, 0.03F).setDelay(10);
EJECTOR_SPAS_ALT = new CasingEjector().setMotion(-0.4, 0.1, 0).setOffset(-0.35, 0, 0.5).setAngleRange(0.01F, 0.03F).setDelay(10).setAmount(2);
EJECTOR_BENELLI = new CasingEjector().setMotion(-0.4, 0.1, 0).setOffset(-0.3, 1, 0).setAngleRange(0.01F, 0.03F);
EJECTOR_UBOINIK = new CasingEjector().setMotion(-0.4, 0.1, 0).setOffset(-0.35, -0.3, 0.5).setAngleRange(0.01F, 0.03F);
EJECTOR_SSG = new CasingEjector().setMotion(0.2, 0, -0.2).setOffset(0.8, 0, 0).setAngleRange(0.05F, 0.02F).setDelay(20).setAmount(2);
CASING12GAUGE = new SpentCasing(CasingType.SHOTGUN).setScale(1.5F).setBounceMotion(0.05F, 0.02F);
}
@ -294,5 +302,50 @@ public class Gun12GaugeFactory {
return bullet;
}
public static BulletConfiguration get12GaugePercussionConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.ammo = new ComparableStack(ModItems.ammo_12gauge.stackFromEnum(Ammo12Gauge.PERCUSSION));
bullet.spread = 0F;
bullet.spentCasing = CASING12GAUGE.clone().register("12GaPerc").setColor(0x9E1616, SpentCasing.COLOR_CASE_12GA);
bullet.maxAge = 0;
bullet.bUpdate = (entityBullet) -> {
if(!entityBullet.worldObj.isRemote) {
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);
}
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();
}
};
return bullet;
}
}

View File

@ -726,7 +726,8 @@ public class ItemAmmoEnums {
SHRAPNEL("ammo_12gauge_shrapnel", AmmoItemTrait.PRO_DAMAGE, AmmoItemTrait.NEU_MORE_BOUNCY, AmmoItemTrait.CON_WEAR),
DU("ammo_12gauge_du", AmmoItemTrait.PRO_DAMAGE, AmmoItemTrait.PRO_PENETRATION, AmmoItemTrait.NEU_HEAVY_METAL, AmmoItemTrait.CON_HEAVY_WEAR),
MARAUDER("ammo_12gauge_marauder", AmmoItemTrait.PRO_MARAUDER, AmmoItemTrait.NEU_NO_CON),
SLEEK("ammo_12gauge_sleek", AmmoItemTrait.NEU_MASKMAN_FLECHETTE);
SLEEK("ammo_12gauge_sleek", AmmoItemTrait.NEU_MASKMAN_FLECHETTE),
PERCUSSION("ammo_12gauge_percussion", AmmoItemTrait.PRO_PERCUSSION, AmmoItemTrait.CON_NO_PROJECTILE);
private final Set<AmmoItemTrait> traits;
private final String unloc;

View File

@ -36,6 +36,7 @@ public class ItemAmmo extends ItemEnumMulti {
CON_NO_EXPLODE3,
CON_NO_FIRE,
CON_NO_MIRV,
CON_NO_PROJECTILE,
CON_PENETRATION,
CON_RADIUS,
CON_RANGE2,
@ -88,6 +89,7 @@ public class ItemAmmo extends ItemEnumMulti {
PRO_NO_GRAVITY,
PRO_NUCLEAR,
PRO_PENETRATION,
PRO_PERCUSSION,
PRO_PHOSPHORUS,
PRO_PHOSPHORUS_SPLASH,
PRO_POISON_GAS,

View File

@ -23,7 +23,7 @@ public class HbmCollection {
/// BULLET COLLECTIONS
// SHOTGUNS
/** 12 GAUGE **/
public static final List<Integer> twelveGauge = ImmutableList.of(BulletConfigSyncingUtil.G12_NORMAL, BulletConfigSyncingUtil.G12_INCENDIARY, BulletConfigSyncingUtil.G12_SHRAPNEL, BulletConfigSyncingUtil.G12_DU, BulletConfigSyncingUtil.G12_AM, BulletConfigSyncingUtil.G12_SLEEK);
public static final List<Integer> twelveGauge = ImmutableList.of(BulletConfigSyncingUtil.G12_NORMAL, BulletConfigSyncingUtil.G12_INCENDIARY, BulletConfigSyncingUtil.G12_SHRAPNEL, BulletConfigSyncingUtil.G12_DU, BulletConfigSyncingUtil.G12_AM, BulletConfigSyncingUtil.G12_SLEEK, BulletConfigSyncingUtil.G12_PERCUSSION);
/** 20 GAUGE **/
public static final List<Integer> twentyGauge = ImmutableList.of(BulletConfigSyncingUtil.G20_NORMAL, BulletConfigSyncingUtil.G20_SLUG, BulletConfigSyncingUtil.G20_FLECHETTE, BulletConfigSyncingUtil.G20_FIRE, BulletConfigSyncingUtil.G20_SHRAPNEL, BulletConfigSyncingUtil.G20_EXPLOSIVE, BulletConfigSyncingUtil.G20_CAUSTIC, BulletConfigSyncingUtil.G20_SHOCK, BulletConfigSyncingUtil.G20_WITHER, BulletConfigSyncingUtil.G20_SLEEK);
/** 4 GAUGE **/
@ -55,6 +55,7 @@ public class HbmCollection {
public static final List<Integer> threeZeroEight = ImmutableList.of(BulletConfigSyncingUtil.W308);
/** 5MM **/
public static final List<Integer> fiveMM = ImmutableList.of(BulletConfigSyncingUtil.R5_NORMAL, BulletConfigSyncingUtil.R5_EXPLOSIVE, BulletConfigSyncingUtil.R5_DU, BulletConfigSyncingUtil.R5_STAR, BulletConfigSyncingUtil.CHL_R5);
/** 5MM LACUNAE **/
public static final List<Integer> fiveMMBolt = ImmutableList.of(BulletConfigSyncingUtil.R5_NORMAL_BOLT, BulletConfigSyncingUtil.R5_EXPLOSIVE_BOLT, BulletConfigSyncingUtil.R5_DU_BOLT, BulletConfigSyncingUtil.R5_STAR_BOLT, BulletConfigSyncingUtil.CHL_R5_BOLT);
// MISC
/** .75 **/
@ -74,8 +75,7 @@ public class HbmCollection {
/// FREQUENTLY USED TRANSLATION KEYS
// GUN MANUFACTURERS
public static enum EnumGunManufacturer
{
public static enum EnumGunManufacturer {
/**Armalite**/
ARMALITE,
/**Auto-Ordnance Corporation**/

View File

@ -17,6 +17,8 @@ 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.particle.SpentCasing;
import com.hbm.tileentity.TileEntityMachineBase;
import api.hbm.energy.IEnergyUser;
@ -90,6 +92,8 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
//tally marks!
public int stattrak;
public int casingDelay;
protected SpentCasing cachedCasingConfig = null;
/**
* X
@ -226,6 +230,14 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
else
this.lastRotationYaw -= Math.PI * 2;
}
if(usesCasings() && this.casingDelay() > 0) {
if(casingDelay > 0) {
casingDelay--;
} else {
spawnCasing();
}
}
}
}
@ -298,6 +310,9 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
public abstract void updateFiringTick();
public boolean usesCasings() { return false; }
public int casingDelay() { return 0; }
public BulletConfiguration getFirstConfigLoaded() {
List<Integer> list = getAmmoList();
@ -336,6 +351,13 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
proj.setThrowableHeading(vec.xCoord, vec.yCoord, vec.zCoord, bullet.velocity, bullet.spread);
worldObj.spawnEntityInWorld(proj);
if(usesCasings()) {
if(this.casingDelay() == 0)
spawnCasing();
else
casingDelay = this.casingDelay();
}
}
public void conusmeAmmo(ComparableStack ammo) {
@ -819,4 +841,25 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
public void closeInventory() {
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.closeC", 1.0F, 1.0F);
}
protected Vec3 getCasingSpawnPos() {
return this.getTurretPos();
}
protected void spawnCasing() {
if(cachedCasingConfig == null) return;
Vec3 spawn = this.getCasingSpawnPos();
final 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);
}
}

View File

@ -830,6 +830,7 @@ desc.item.ammo.con_no_explode2=- No block damage
desc.item.ammo.con_no_explode3=- No splash damage
desc.item.ammo.con_no_fire=- Not incendiary
desc.item.ammo.con_no_mirv=- Not recommended for the Proto MIRV
desc.item.ammo.con_no_projectile=- No projectile
desc.item.ammo.con_penetration=- Not penetrating
desc.item.ammo.con_radius=- Decreased blast radius
desc.item.ammo.con_range2=- Highly decreased range
@ -882,6 +883,7 @@ desc.item.ammo.pro_mining=+ Explosion drops all blocks
desc.item.ammo.pro_no_gravity=+ Not affected by gravity
desc.item.ammo.pro_nuclear=+ Nuclear
desc.item.ammo.pro_penetration=+ Penetrating
desc.item.ammo.pro_percussion=+ Percussive blast
desc.item.ammo.pro_phosphorus=+ Induces phosphorus burns
desc.item.ammo.pro_phosphorus_splash=+ Phosphorus splash
desc.item.ammo.pro_poison_gas=+ Poison splash

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B