From 9f758c49bc323ed7184d691f900a34e7cbd0ac4c Mon Sep 17 00:00:00 2001 From: Boblet Date: Thu, 15 May 2025 16:01:15 +0200 Subject: [PATCH] dud crap --- changelog | 9 ++- .../com/hbm/blocks/bomb/BlockCrashedBomb.java | 78 +++++++++++++++---- .../java/com/hbm/crafting/ToolRecipes.java | 1 - src/main/java/com/hbm/items/ModItems.java | 2 +- .../com/hbm/items/tool/ItemAmatExtractor.java | 44 ----------- .../com/hbm/items/weapon/ItemAmmoArty.java | 6 +- 6 files changed, 75 insertions(+), 65 deletions(-) diff --git a/changelog b/changelog index 25db9ffc5..c866d443b 100644 --- a/changelog +++ b/changelog @@ -1,10 +1,11 @@ ## Added * Sandbags * Connect to other sandbags or solid blocks - * Pretts + * Pretty * Wooden barrier * Pretty * Automatically walls off connected solid blocks in addition to the direction it was placed in +* Some other wooden blocks like a roof, ceiling and scaffold ## Changed * Increased bayonet damage from 5 to 7.5 hearts @@ -16,8 +17,12 @@ * New server configs * `CRATE_OPEN_HELD` can toggle whether crates can be opened when held * `CRATE_KEEP_CONTENTS` can toggle whether crates keep their contents when broken +* Duds now have multiple variants + * Dismantling different variants yields different drops + * Magnetic extraction can no longer be performed ## Fixed * Fixed RoR controller having the wrong recipe * Either fixed the crate dupe/voiding issues or made them even worse -* Fixed skeletons and pedestals allowing blocks to be placed inside the player \ No newline at end of file +* Fixed skeletons and pedestals allowing blocks to be placed inside the player +* Fixed artillery shells not playing the explosion animation when directly impacting entities \ No newline at end of file diff --git a/src/main/java/com/hbm/blocks/bomb/BlockCrashedBomb.java b/src/main/java/com/hbm/blocks/bomb/BlockCrashedBomb.java index 191b36173..811d2a128 100644 --- a/src/main/java/com/hbm/blocks/bomb/BlockCrashedBomb.java +++ b/src/main/java/com/hbm/blocks/bomb/BlockCrashedBomb.java @@ -3,11 +3,20 @@ package com.hbm.blocks.bomb; import com.hbm.blocks.BlockEnumMulti; import com.hbm.config.BombConfig; import com.hbm.entity.logic.EntityBalefire; +import com.hbm.entity.logic.EntityNukeExplosionMK5; +import com.hbm.explosion.vanillant.ExplosionVNT; +import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard; +import com.hbm.explosion.vanillant.standard.BlockProcessorStandard; +import com.hbm.explosion.vanillant.standard.EntityProcessorCross; +import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard; import com.hbm.handler.threading.PacketThreading; import com.hbm.interfaces.IBomb; import com.hbm.items.ModItems; +import com.hbm.main.MainRegistry; import com.hbm.packet.toclient.AuxParticlePacketNT; +import com.hbm.particle.helper.ExplosionCreator; import com.hbm.tileentity.bomb.TileEntityCrashedBomb; +import com.hbm.util.EnumUtil; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraft.block.ITileEntityProvider; @@ -42,11 +51,27 @@ public class BlockCrashedBomb extends BlockEnumMulti implements ITileEntityProvi if(world.isRemote) return true; if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.defuser) { + + EnumDudType type = EnumUtil.grabEnumSafely(EnumDudType.class, world.getBlockMetadata(x, y, z)); + //TODO: make this less scummy + if(type == type.BALEFIRE) { + world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.egg_balefire_shard))); + } + if(type == type.CONVENTIONAL) { + world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.ball_tnt, 16))); + } + if(type == type.NUKE) { + world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.ball_tnt, 8))); + world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.billet_plutonium, 4))); + } + if(type == type.SALTED) { + world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.ball_tnt, 8))); + world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.billet_plutonium, 2))); + world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.ingot_cobalt, 12))); + } + world.func_147480_a(x, y, z, false); - world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.egg_balefire_shard))); - world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.plate_steel, 10 + world.rand.nextInt(15)))); - world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.plate_titanium, 2 + world.rand.nextInt(7)))); return true; } @@ -59,20 +84,45 @@ public class BlockCrashedBomb extends BlockEnumMulti implements ITileEntityProvi if(!world.isRemote) { world.setBlockToAir(x, y, z); - EntityBalefire bf = new EntityBalefire(world); - bf.posX = x; - bf.posY = y; - bf.posZ = z; - bf.destructionRange = (int) (BombConfig.fatmanRadius * 1.25); - world.spawnEntityInWorld(bf); + EnumDudType type = EnumUtil.grabEnumSafely(EnumDudType.class, world.getBlockMetadata(x, y, z)); - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", "muke"); - data.setBoolean("balefire", true); - PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x + 0.5, y + 0.5, z + 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 0.5, z + 0.5, 250)); - world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:weapon.mukeExplosion", 15.0F, 1.0F); + if(type == type.BALEFIRE) { + EntityBalefire bf = new EntityBalefire(world); + bf.setPosition(x, y, z); + bf.destructionRange = (int) (BombConfig.fatmanRadius * 1.25); + world.spawnEntityInWorld(bf); + spawnMush(world, x, y, z, true); + } + + if(type == type.CONVENTIONAL) { + ExplosionVNT xnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 35F); + xnt.setBlockAllocator(new BlockAllocatorStandard(24)); + xnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop()); + xnt.setEntityProcessor(new EntityProcessorCross(5D).withRangeMod(1.5F)); + xnt.setPlayerProcessor(new PlayerProcessorStandard()); + xnt.explode(); + ExplosionCreator.composeEffectLarge(world, x + 0.5, y + 0.5, z + 0.5); + } + + if(type == type.NUKE) { + world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, 35, x + 0.5, y + 0.5, z + 0.5)); + spawnMush(world, x, y, z, MainRegistry.polaroidID == 11 || world.rand.nextInt(100) == 0); + } + + if(type == type.SALTED) { + world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, 25, x + 0.5, y + 0.5, z + 0.5).moreFallout(25)); + spawnMush(world, x, y, z, MainRegistry.polaroidID == 11 || world.rand.nextInt(100) == 0); + } } return BombReturnCode.DETONATED; } + + public static void spawnMush(World world, int x, int y, int z, boolean balefire) { + world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:weapon.mukeExplosion", 15.0F, 1.0F); + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "muke"); + data.setBoolean("balefire", balefire); + PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, x + 0.5, y + 0.5, z + 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 0.5, z + 0.5, 250)); + } } diff --git a/src/main/java/com/hbm/crafting/ToolRecipes.java b/src/main/java/com/hbm/crafting/ToolRecipes.java index 4399f08c3..26a04b5fe 100644 --- a/src/main/java/com/hbm/crafting/ToolRecipes.java +++ b/src/main/java/com/hbm/crafting/ToolRecipes.java @@ -129,7 +129,6 @@ public class ToolRecipes { CraftingManager.addRecipeAuto(new ItemStack(ModItems.defuser, 1), new Object[] { " PS", "P P", " P ", 'P', ANY_PLASTIC.ingot(), 'S', STEEL.plate() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.coltan_tool, 1), new Object[] { "ACA", "CXC", "ACA", 'A', ALLOY.ingot(), 'C', CINNABAR.crystal(), 'X', Items.compass }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.reacher, 1), new Object[] { "BIB", "P P", "B B", 'B', W.bolt(), 'I', W.ingot(), 'P', ANY_RUBBER.ingot() }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.bismuth_tool, 1), new Object[] { "TBT", "SRS", "SCS", 'T', TA.nugget(), 'B', ModItems.nugget_bismuth, 'S', ANY_RESISTANTALLOY.ingot(), 'R', ModItems.reacher, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CHIP) }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.sat_designator, 1), new Object[] { "RRD", "PIC", " P", 'P', GOLD.plate(), 'R', Items.redstone, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'D', ModItems.sat_chip, 'I', GOLD.ingot() }); CraftingManager.addShapelessAuto(new ItemStack(ModItems.sat_relay), new Object[] { ModItems.sat_chip, ModItems.ducttape, ModItems.radar_linker }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.settings_tool), new Object[] { " P ", "PCP", "III", 'P', IRON.plate(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ANALOG), 'I', ModItems.plate_polymer }); diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index be5922927..63715bbe3 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -3883,7 +3883,7 @@ public class ModItems { defuser = new ItemTooling(ToolType.DEFUSER, 100).setUnlocalizedName("defuser").setMaxStackSize(1).setFull3D().setCreativeTab(MainRegistry.nukeTab).setTextureName(RefStrings.MODID + ":defuser"); reacher = new Item().setUnlocalizedName("reacher").setMaxStackSize(1).setFull3D().setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":reacher"); - bismuth_tool = new ItemAmatExtractor().setUnlocalizedName("bismuth_tool").setMaxStackSize(1).setFull3D().setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":bismuth_tool"); + bismuth_tool = new ItemAmatExtractor().setUnlocalizedName("bismuth_tool").setMaxStackSize(1).setFull3D().setCreativeTab(null).setTextureName(RefStrings.MODID + ":bismuth_tool"); meltdown_tool = new ItemDyatlov().setUnlocalizedName("meltdown_tool").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":meltdown_tool"); flame_pony = new ItemCustomLore().setUnlocalizedName("flame_pony").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":flame_pony"); diff --git a/src/main/java/com/hbm/items/tool/ItemAmatExtractor.java b/src/main/java/com/hbm/items/tool/ItemAmatExtractor.java index ffd2b3ddb..0086e8474 100644 --- a/src/main/java/com/hbm/items/tool/ItemAmatExtractor.java +++ b/src/main/java/com/hbm/items/tool/ItemAmatExtractor.java @@ -1,50 +1,6 @@ package com.hbm.items.tool; -import com.hbm.blocks.bomb.BlockCrashedBomb; -import com.hbm.items.ModItems; -import com.hbm.util.ContaminationUtil; -import com.hbm.util.ContaminationUtil.ContaminationType; -import com.hbm.util.ContaminationUtil.HazardType; - -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; public class ItemAmatExtractor extends Item { - - @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { - - if(world.getBlock(x, y, z) instanceof BlockCrashedBomb) { - if(!world.isRemote && player.inventory.hasItem(ModItems.cell_empty)) { - - float chance = world.rand.nextFloat(); - - if(chance < 0.01) { - ((BlockCrashedBomb) world.getBlock(x, y, z)).explode(world, x, y, z); - } else if(chance <= 0.3) { - player.inventory.consumeInventoryItem(ModItems.cell_empty); - - if(!player.inventory.addItemStackToInventory(new ItemStack(ModItems.cell_balefire))) { - player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.cell_balefire, 1, 0), false); - } - } else { - player.inventory.consumeInventoryItem(ModItems.cell_empty); - - if(!player.inventory.addItemStackToInventory(new ItemStack(ModItems.cell_antimatter))) { - player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.cell_antimatter, 1, 0), false); - } - } - - player.inventoryContainer.detectAndSendChanges(); - ContaminationUtil.contaminate(player, HazardType.RADIATION, ContaminationType.CREATIVE, 50.0F); - } - - player.swingItem(); - return true; - } - - return false; - } } diff --git a/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java b/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java index 6d968fcfd..1f9cd0582 100644 --- a/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java +++ b/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java @@ -245,9 +245,9 @@ public class ItemAmmoArty extends Item { private void init() { /* STANDARD SHELLS */ - this.itemTypes[NORMAL] = new ArtilleryShell("ammo_arty", SpentCasing.COLOR_CASE_16INCH) { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 10F, 3F, false); ExplosionCreator.composeEffect(shell.worldObj, mop.blockX + 0.5, mop.blockY + 0.5, mop.blockZ + 0.5, 10, 2F, 0.5F, 25F, 5, 0, 20, 0.75F, 1F, -2F, 150); }}; - 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); ExplosionCreator.composeEffect(shell.worldObj, mop.blockX + 0.5, mop.blockY + 0.5, mop.blockZ + 0.5, 15, 5F, 1F, 45F, 10, 0, 50, 1F, 3F, -2F, 200); }}; - 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); ExplosionCreator.composeEffect(shell.worldObj, mop.blockX + 0.5, mop.blockY + 0.5, mop.blockZ + 0.5, 15, 5F, 1F, 45F, 10, 16, 50, 1F, 3F, -2F, 200); }}; + this.itemTypes[NORMAL] = new ArtilleryShell("ammo_arty", SpentCasing.COLOR_CASE_16INCH) { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 10F, 3F, false); ExplosionCreator.composeEffect(shell.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 10, 2F, 0.5F, 25F, 5, 0, 20, 0.75F, 1F, -2F, 150); }}; + 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); ExplosionCreator.composeEffect(shell.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 15, 5F, 1F, 45F, 10, 0, 50, 1F, 3F, -2F, 200); }}; + 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); ExplosionCreator.composeEffect(shell.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 15, 5F, 1F, 45F, 10, 16, 50, 1F, 3F, -2F, 200); }}; /* MINI NUKE */ this.itemTypes[MINI_NUKE] = new ArtilleryShell("ammo_arty_mini_nuke", SpentCasing.COLOR_CASE_16INCH_NUKE) {