From b2d52e8cfab4df3a3e7aa71f6cfc5f1e51305a43 Mon Sep 17 00:00:00 2001 From: Boblet Date: Mon, 3 Nov 2025 16:34:31 +0100 Subject: [PATCH] you can now cut off big man johnson's johnson --- changelog | 12 +++- .../hbm/handler/ability/IWeaponAbility.java | 23 ++------ src/main/java/com/hbm/items/ModItems.java | 2 +- .../com/hbm/items/armor/ItemModDefuser.java | 42 ++++++++------ .../java/com/hbm/items/tool/ItemDefuser.java | 55 +++++++++++++++++++ .../java/com/hbm/main/ModEventHandler.java | 4 ++ .../machine/TileEntityMachineAutosaw.java | 7 +-- 7 files changed, 103 insertions(+), 42 deletions(-) create mode 100644 src/main/java/com/hbm/items/tool/ItemDefuser.java diff --git a/changelog b/changelog index d9e432e3f..739285b0a 100644 --- a/changelog +++ b/changelog @@ -25,6 +25,14 @@ * This means that in system with slow input, the time window when items can be added to the arc furance is now more forgiving * Pipe anchors now have a look overlay showing the currently configured fluid type * Removed ammo duping using nitra, instead, four large piles can now be combined into an ammo container +* Using a defuser, creepers can now be rendered harmless manually +* Defusing creepers now also works if the creeper hasn't lit its fuse yet +* Defused creepers are now permanently harmless, they can no longer be manually re-ignited at all +* Manual defusers now also affect big man johnson + * The glpyhid will explode instantly, but only about as powerful as a conventional rocket, not destroying blocks + * Doing so will also drop one usable demolition mini nuke +* The painsaw ability no longer plays the blood splash particle effect + * Instead, it will outright gib the target ## Fixed * Fixed arc furnace only allowing electrodes to be inserted when the lid is down instead of up @@ -32,4 +40,6 @@ * Fixed multi fluid ID search potentially not working on systems with a non-latin locale * Fixed particle accelerator source working even if not cooled * Fixed foundry channels being overly laggy in certain setups -* Fixed potential mod incompatibilities with world generation mods that use outdated forge hooks \ No newline at end of file +* Fixed potential mod incompatibilities with world generation mods that use outdated forge hooks +* Fixed the buzzsaw not properly replanting trees using the `leaves2` block type +* Fixed creepers regaining their exploding AI task upon relog, if defused \ No newline at end of file diff --git a/src/main/java/com/hbm/handler/ability/IWeaponAbility.java b/src/main/java/com/hbm/handler/ability/IWeaponAbility.java index f3571ab6a..52f75f5b6 100644 --- a/src/main/java/com/hbm/handler/ability/IWeaponAbility.java +++ b/src/main/java/com/hbm/handler/ability/IWeaponAbility.java @@ -2,16 +2,13 @@ package com.hbm.handler.ability; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.BlockBobble.BobbleType; -import com.hbm.handler.threading.PacketThreading; import com.hbm.items.ModItems; -import com.hbm.packet.toclient.AuxParticlePacketNT; +import com.hbm.items.weapon.sedna.factory.ConfettiUtil; import com.hbm.potion.HbmPotion; import com.hbm.util.ContaminationUtil; import com.hbm.util.ContaminationUtil.ContaminationType; import com.hbm.util.ContaminationUtil.HazardType; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityXPOrb; @@ -22,8 +19,6 @@ import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntitySlime; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -253,7 +248,7 @@ public interface IWeaponAbility extends IBaseAbility { @Override public void onHit(int level, World world, EntityPlayer player, Entity victim, Item tool) { int divider = dividerAtLevel[level]; - + if(victim instanceof EntityLivingBase) { EntityLivingBase living = (EntityLivingBase) victim; @@ -264,18 +259,8 @@ public interface IWeaponAbility extends IBaseAbility { living.entityDropItem(new ItemStack(ModItems.nitra_small), 1); world.spawnEntityInWorld(new EntityXPOrb(world, living.posX, living.posY, living.posZ, 1)); } - - if(player instanceof EntityPlayerMP) { - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", "vanillaburst"); - data.setInteger("count", count * 4); - data.setDouble("motion", 0.1D); - data.setString("mode", "blockdust"); - data.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block)); - PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, living.posX, living.posY + living.height * 0.5, living.posZ), - new TargetPoint(living.dimension, living.posX, living.posY, living.posZ, 50)); - } - + + ConfettiUtil.gib(living); world.playSoundEffect(living.posX, living.posY + living.height * 0.5, living.posZ, "hbm:weapon.chainsaw", 0.5F, 1.0F); } } diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 7edac6a80..8b85f9fef 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -3840,7 +3840,7 @@ public class ModItems { glyphid_meat_grilled = new ItemLemon(8, 0.75F, true).setPotionEffect(Potion.damageBoost.id, 180, 1, 1F).setUnlocalizedName("glyphid_meat_grilled").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":glyphid_meat_grilled"); egg_glyphid = new Item().setUnlocalizedName("egg_glyphid").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":egg_glyphid"); - defuser = new ItemTooling(ToolType.DEFUSER, 100).setUnlocalizedName("defuser").setMaxStackSize(1).setFull3D().setCreativeTab(MainRegistry.nukeTab).setTextureName(RefStrings.MODID + ":defuser"); + defuser = new ItemDefuser(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(null).setTextureName(RefStrings.MODID + ":bismuth_tool"); meltdown_tool = new ItemDyatlov().setUnlocalizedName("meltdown_tool").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":meltdown_tool"); diff --git a/src/main/java/com/hbm/items/armor/ItemModDefuser.java b/src/main/java/com/hbm/items/armor/ItemModDefuser.java index dba9dc6ff..fafc290f1 100644 --- a/src/main/java/com/hbm/items/armor/ItemModDefuser.java +++ b/src/main/java/com/hbm/items/armor/ItemModDefuser.java @@ -42,30 +42,38 @@ public class ItemModDefuser extends ItemArmorMod { List creepers = entity.worldObj.getEntitiesWithinAABB(EntityCreeper.class, entity.boundingBox.expand(5, 5, 5)); - for(EntityCreeper creeper : creepers) { - - if(creeper.getCreeperState() == 1 || creeper.func_146078_ca()) { - creeper.setCreeperState(-1); - creeper.getDataWatcher().updateObject(18, new Byte((byte) 0)); - - EntityAICreeperSwell toRem = null; - for(Object o : creeper.tasks.taskEntries) { - EntityAITaskEntry entry = (EntityAITaskEntry) o; - - if(entry.action instanceof EntityAICreeperSwell) { - toRem = (EntityAICreeperSwell) entry.action; - break; - } + for(EntityCreeper creeper : creepers) defuse(creeper, entity, true); + } + + public static boolean defuse(EntityCreeper creeper, EntityLivingBase entity, boolean dropItem) { + + creeper.setCreeperState(-1); + creeper.getDataWatcher().updateObject(18, new Byte((byte) 0)); + + if(!creeper.worldObj.isRemote) { + EntityAICreeperSwell toRem = null; + for(Object o : creeper.tasks.taskEntries) { + EntityAITaskEntry entry = (EntityAITaskEntry) o; + + if(entry.action instanceof EntityAICreeperSwell) { + toRem = (EntityAICreeperSwell) entry.action; + break; } - - if(toRem != null) { - creeper.tasks.removeTask(toRem); + } + + if(toRem != null) { + creeper.tasks.removeTask(toRem); + if(dropItem) { creeper.worldObj.playSoundEffect(creeper.posX, creeper.posY, creeper.posZ, "hbm:item.pinBreak", 1.0F, 1.0F); creeper.dropItem(ModItems.safety_fuse, 1); creeper.attackEntityFrom(DamageSource.causeMobDamage(entity), 1.0F); creeper.addPotionEffect(new PotionEffect(Potion.weakness.id, 0, 200)); } + creeper.getEntityData().setBoolean("hfr_defused", true); + return true; } } + + return false; } } diff --git a/src/main/java/com/hbm/items/tool/ItemDefuser.java b/src/main/java/com/hbm/items/tool/ItemDefuser.java new file mode 100644 index 000000000..9a1aa6d9b --- /dev/null +++ b/src/main/java/com/hbm/items/tool/ItemDefuser.java @@ -0,0 +1,55 @@ +package com.hbm.items.tool; + +import com.hbm.entity.mob.glyphid.EntityGlyphidNuclear; +import com.hbm.explosion.vanillant.ExplosionVNT; +import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth; +import com.hbm.explosion.vanillant.standard.ExplosionEffectWeapon; +import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard; +import com.hbm.inventory.OreDictManager.DictFrame; +import com.hbm.items.ModItems; +import com.hbm.items.armor.ItemModDefuser; +import com.hbm.items.weapon.sedna.factory.ConfettiUtil; +import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; + +import api.hbm.block.IToolable.ToolType; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +public class ItemDefuser extends ItemTooling { + + public ItemDefuser(ToolType type, int durability) { + super(type, durability); + } + + @Override + public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity) { + + if(entity instanceof EntityCreeper) { + return ItemModDefuser.defuse((EntityCreeper) entity, player, true); + } + + if(entity instanceof EntityGlyphidNuclear) { + EntityGlyphidNuclear john = (EntityGlyphidNuclear) entity; + + if(!player.worldObj.isRemote && john.deathTicks > 0) { + john.setDead(); + + ExplosionVNT vnt = new ExplosionVNT(john.worldObj, john.posX, john.posY, john.posZ, 5F, john); + vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, 20).setupPiercing(10F, 0.2F)); + vnt.setPlayerProcessor(new PlayerProcessorStandard()); + vnt.setSFX(new ExplosionEffectWeapon(10, 2.5F, 1F)); + vnt.explode(); + + ConfettiUtil.gib(john); + + john.entityDropItem(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.NUKE_DEMO), 1.5F); + } + + return true; + } + + return false; + } +} diff --git a/src/main/java/com/hbm/main/ModEventHandler.java b/src/main/java/com/hbm/main/ModEventHandler.java index 7632100df..39027aaa8 100644 --- a/src/main/java/com/hbm/main/ModEventHandler.java +++ b/src/main/java/com/hbm/main/ModEventHandler.java @@ -494,6 +494,10 @@ public class ModEventHandler { @SubscribeEvent public void onLivingUpdate(LivingUpdateEvent event) { + + if(event.entityLiving instanceof EntityCreeper && event.entityLiving.getEntityData().getBoolean("hfr_defused")) { + ItemModDefuser.defuse((EntityCreeper) event.entityLiving, null, false); + } ItemStack[] prevArmor = event.entityLiving.previousEquipment; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAutosaw.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAutosaw.java index 7763e5ee7..8b7a7a836 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAutosaw.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAutosaw.java @@ -145,8 +145,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IB double relAngle = Math.abs(angle - rotationYawRads); relAngle = Math.abs((relAngle + Math.PI) % (2 * Math.PI) - Math.PI); - if(relAngle > CUT_ANGLE) - continue; + if(relAngle > CUT_ANGLE) continue; int x = xCoord + dx; int y = yCoord + 1; @@ -157,8 +156,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IB continue; int meta = worldObj.getBlockMetadata(x, y, z); - if(shouldIgnore(worldObj, x, y, z, b, meta)) - continue; + if(shouldIgnore(worldObj, x, y, z, b, meta)) continue; state = 1; break outer; @@ -340,6 +338,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IB worldObj.func_147480_a(x + d[0], i, z + d[1], true); } else if(b instanceof BlockLeaves) { meta = worldObj.getBlockMetadata(x + d[0], i, z + d[1]) & 3; + if(b == Blocks.leaves2) meta += 4; worldObj.func_147480_a(x + d[0], i, z + d[1], true); } }