This commit is contained in:
Bob 2026-04-09 22:28:03 +02:00
parent 87d21cf2a7
commit 566043d888
8 changed files with 43 additions and 16 deletions

View File

@ -23,7 +23,6 @@ public class DispenserBehaviorHandler {
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_universal, new BehaviorDefaultDispenseItem() {
@Override protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
IPosition iposition = BlockDispenser.func_149939_a(source);
EnumFacing enumfacing = BlockDispenser.func_149937_b(source.getBlockMetadata());
EntityGrenadeUniversal grenade = new EntityGrenadeUniversal(source.getWorld(), stack);

View File

@ -46,26 +46,29 @@ public class ItemGrenadeFilling extends ItemEnumMulti {
public static BulletConfig fragmentation;
public static BulletConfig pellets;
public static BulletConfig pellets_heavy;
public static BulletConfig laser;
public ItemGrenadeFilling() {
super(EnumGrenadeFilling.class, true, true);
fragmentation = new BulletConfig().setLife(3).setThresholdNegation(5F).setRicochetAngle(90).setRicochetCount(2);
pellets = new BulletConfig().setLife(100).setGrav(0.04).setVel(1.5F).setOnImpact(LAMBDA_TINY_EXPLODE);
pellets_heavy = new BulletConfig().setLife(100).setGrav(0.04).setVel(1.5F).setOnImpact(LAMBDA_EXPLODE);
laser = new BulletConfig().setBeam().setupDamageClass(DamageClass.LASER).setLife(3).setRenderRotations(false).setThresholdNegation(10F).setOnBeamImpact(BulletConfig.LAMBDA_STANDARD_BEAM_HIT);
}
public static enum EnumGrenadeFilling {
POWDER(EXPLODE_POWDER, 0x424242, 0x939176, FRAG, STICK), // gunpowder
HE(EXPLODE_HE, 0x595533, 0xA49D62, FRAG, STICK), // high explosive
DEMO(EXPLODE_DEMO, 0x595533, 0xDD4029, FRAG, STICK), // demolition
INC(EXPLODE_INC, 0x5A5A5A, 0xFF5F21, FRAG, STICK), // incendiary
CLUSTER(EXPLODE_CLUSTER, 0x5A5A5A, 0xFFC711, FRAG, STICK, NUKE), // explosive pellets
EMP(EXPLODE_EMP, 0x93A1AC, 0x00FFFF, TECH), // tesla
PLASMA(EXPLODE_PLASMA, 0x655B2C, 0x4CFF00, TECH), // EMP but more oomph
LASER(EXPLODE_LASER, 0x493A3A, 0xFF0000, TECH), // pew pew pew
NUCLEAR(EXPLODE_NUKE, 0xDFD7A8, 0xA49D62, NUKE), // nuka grenade
NUCLEAR_DEMO(EXPLODE_NUKE_DEMO, 0xDFD7A8, 0xDD4029, NUKE); // demolition nuka grenade
POWDER(EXPLODE_POWDER, 0x424242, 0x939176, FRAG, STICK), // gunpowder
HE(EXPLODE_HE, 0x595533, 0xA49D62, FRAG, STICK), // high explosive
DEMO(EXPLODE_DEMO, 0x595533, 0xDD4029, FRAG, STICK), // demolition
INC(EXPLODE_INC, 0x5A5A5A, 0xFF5F21, FRAG, STICK), // incendiary
CLUSTER(EXPLODE_CLUSTER, 0x5A5A5A, 0xFFC711, FRAG, STICK), // explosive pellets
EMP(EXPLODE_EMP, 0x93A1AC, 0x00FFFF, TECH), // tesla
PLASMA(EXPLODE_PLASMA, 0x655B2C, 0x4CFF00, TECH), // EMP but more oomph
LASER(EXPLODE_LASER, 0x493A3A, 0xFF0000, TECH), // pew pew pew
CLUSTER_HEAVY(EXPLODE_CLUSTER_HEAVY, 0x5A5A5A, 0xFF5F21, NUKE), // cluster but fat
NUCLEAR(EXPLODE_NUKE, 0xDFD7A8, 0xA49D62, NUKE), // nuka grenade
NUCLEAR_DEMO(EXPLODE_NUKE_DEMO, 0xDFD7A8, 0xDD4029, NUKE); // demolition nuka grenade
public Consumer<EntityGrenadeUniversal> explode;
public Set<EnumGrenadeShell> compatibleShells = new HashSet();
@ -83,13 +86,13 @@ public class ItemGrenadeFilling extends ItemEnumMulti {
public static Consumer<EntityGrenadeUniversal> EXPLODE_POWDER = (grenade) -> { standardExplode(grenade, 5F, 10F, 5F, 0F); };
public static Consumer<EntityGrenadeUniversal> EXPLODE_HE = (grenade) -> { standardExplode(grenade, 7.5F, 25F, 10F, 0.1F); };
public static Consumer<EntityGrenadeUniversal> EXPLODE_CLUSTER = (grenade) -> {
standardExplode(grenade, 7.5F, 15F, 10F, 0.1F);
int frags = 30;
if(grenade.getShell() == EnumGrenadeShell.FRAG) frags *= 1.25;
for(int i = 0; i < frags; i++) {
EntityBulletBaseMK4 bullet = new EntityBulletBaseMK4(grenade.worldObj, pellets, 10F, 0F, grenade.worldObj.rand.nextFloat() * 2F * (float) Math.PI, (grenade.worldObj.rand.nextFloat() * 0.5F + 0.5F) * (float) Math.PI);
EntityBulletBaseMK4 bullet = new EntityBulletBaseMK4(grenade.worldObj, pellets, 15F, 0F, grenade.worldObj.rand.nextFloat() * 2F * (float) Math.PI, (grenade.worldObj.rand.nextFloat() * 0.5F + 0.5F) * (float) Math.PI);
bullet.setPosition(grenade.posX, grenade.posY + 0.05, grenade.posZ);
bullet.motionX *= 0.5;
bullet.motionY *= 0.75;
@ -97,6 +100,19 @@ public class ItemGrenadeFilling extends ItemEnumMulti {
grenade.worldObj.spawnEntityInWorld(bullet);
}
};
public static Consumer<EntityGrenadeUniversal> EXPLODE_CLUSTER_HEAVY = (grenade) -> {
standardExplode(grenade, 7.5F, 15F, 10F, 0.1F);
int frags = 15;
for(int i = 0; i < frags; i++) {
EntityBulletBaseMK4 bullet = new EntityBulletBaseMK4(grenade.worldObj, pellets_heavy, 30F, 0F, grenade.worldObj.rand.nextFloat() * 2F * (float) Math.PI, (grenade.worldObj.rand.nextFloat() * 0.5F + 0.5F) * (float) Math.PI);
bullet.setPosition(grenade.posX, grenade.posY + 0.05, grenade.posZ);
bullet.motionX *= 0.5;
bullet.motionY *= 1.25;
bullet.motionZ *= 0.5;
grenade.worldObj.spawnEntityInWorld(bullet);
}
};
public static Consumer<EntityGrenadeUniversal> EXPLODE_DEMO = (grenade) -> {
ExplosionVNT vnt = new ExplosionVNT(grenade.worldObj, grenade.posX, grenade.posY, grenade.posZ, 5F, grenade.getThrower());
@ -228,6 +244,12 @@ public class ItemGrenadeFilling extends ItemEnumMulti {
bullet.setDead();
};
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_EXPLODE = (bullet, mop) -> {
if(bullet.ticksExisted < 2) return;
Lego.standardExplode(bullet, mop, 5F);
bullet.setDead();
};
public static void standardExplode(EntityGrenadeUniversal grenade, float range, float damage) { standardExplode(grenade, range, damage, 0F, 0F); }
public static void standardExplode(EntityGrenadeUniversal grenade, float range, float damage, float dt, float dr) {
ExplosionVNT vnt = new ExplosionVNT(grenade.worldObj, grenade.posX, grenade.posY, grenade.posZ, range, grenade.getThrower());

View File

@ -117,6 +117,9 @@ public class ItemGrenadeUniversal extends Item implements IEquipReceiver, IAnima
if(shell == EnumGrenadeShell.TECH && deployment == 18) {
world.playSoundAtEntity(player, NTMSounds.GRENADE_TECH, 1F, 1F);
}
if(shell == EnumGrenadeShell.NUKE && deployment == 26) {
world.playSoundAtEntity(player, NTMSounds.GRENADE_NUKA, 1F, 1F);
}
}
}

View File

@ -244,8 +244,7 @@ public class GunFactoryClient {
setRendererBulk(LegoClient.RENDER_GRENADE, shell_normal, shell_explosive, shell_ap, shell_du, shell_w9); //TODO: change the sabots
ItemGrenadeFilling.fragmentation.setRenderer(LegoClient.RENDER_FRAGMENTATION);
ItemGrenadeFilling.pellets.setRenderer(LegoClient.RENDER_FRAGMENTATION);
setRendererBulk(LegoClient.RENDER_FRAGMENTATION, ItemGrenadeFilling.fragmentation, ItemGrenadeFilling.pellets, ItemGrenadeFilling.pellets_heavy);
ItemGrenadeFilling.laser.setRendererBeam(LegoClient.RENDER_LASER_RED);
//HUDS

View File

@ -26,6 +26,7 @@ import com.hbm.world.gen.MapGenChainloader;
import com.hbm.world.generator.CellularDungeonFactory;
import com.hbm.world.generator.DungeonToolbox;
import cpw.mods.fml.common.IWorldGenerator;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@ -495,7 +496,8 @@ public class HbmWorldGen implements IWorldGenerator {
int x = i + rand.nextInt(16) + 8;
int z = j + rand.nextInt(16) + 8;
int y = world.getHeightValue(x, z) - rand.nextInt(10);
if(y > 1) (new Meteorite()).generate(world, rand, x, y, z, false, false, false);
Block b = world.getBlock(x, y - 2, z);
if(!b.isAir(world, x, y, z) && !b.getMaterial().isLiquid() && y > 1) (new Meteorite()).generate(world, rand, x, y, z, false, false, false);
}
if(rand.nextInt(4) == 0) {

View File

@ -35,6 +35,7 @@ public class NTMSounds {
public static final String GUN_VALVE = "hbm:weapon.reload.pressureValve";
public static final String GUN_FATMAN_RELOAD = "hbm:weapon.reload.fatmanFull";
public static final String GRENADE_TECH = "hbm:weapon.reload.grenadeTech";
public static final String GRENADE_NUKA = "hbm:weapon.reload.grenadeNuka";
/// FOLEY ///
public static final String GUN_WHACK = "hbm:weapon.foley.gunWhack";

View File

@ -295,6 +295,7 @@
"weapon.reload.fatmanFull": {"category": "player", "sounds": ["weapon/reload/fatmanFull"]},
"weapon.reload.screw": {"category": "player", "sounds": ["weapon/reload/screw"]},
"weapon.reload.grenadeTech": {"category": "player", "sounds": ["weapon/reload/grenadeTech"]},
"weapon.reload.grenadeNuka": {"category": "player", "sounds": ["weapon/reload/grenadeNuka"]},
"weapon.foley.gunWhack": {"category": "player", "sounds": ["weapon/foley/gunWhack", "weapon/foley/gunWhack2"]},