From e776b4c8d910bf6ccdcc293cb3b6acdfece5a072 Mon Sep 17 00:00:00 2001 From: Boblet Date: Tue, 20 Jan 2026 16:56:00 +0100 Subject: [PATCH] the gloach --- changelog | 7 ++++- .../hbm/items/weapon/sedna/ItemGunBaseNT.java | 2 +- .../weapon/sedna/factory/GunFactory.java | 30 +++++++++++++++++-- .../sedna/factory/GunFactoryClient.java | 4 ++- .../weapon/sedna/factory/GunStateDecider.java | 3 +- .../hbm/items/weapon/sedna/factory/Lego.java | 14 +++++---- .../weapon/sedna/factory/LegoClient.java | 1 + .../weapon/sedna/factory/XFactory9mm.java | 2 +- .../weapon/sedna/factory/XFactoryFolly.java | 2 +- .../sedna/hud/HUDComponentAmmoCounter.java | 4 +-- 10 files changed, 53 insertions(+), 16 deletions(-) diff --git a/changelog b/changelog index ba1fe08f2..d2401a7a1 100644 --- a/changelog +++ b/changelog @@ -1,9 +1,14 @@ ## Changed +* Updated russian localization * Rad absorbers now use metadata, existing blocks will be converted automatically * Fissure bombs that go off in crater biomes now create fissures with metadata 1 which creates radioactive volcanic lava * If a crater biome is created on top of an existing fissue, it will keep producing normal volcanic lava * Simplified the battery socket's client packets, reducing CPU load +* Muzzle flashes on guns now work in third person mode, including on other players and on NPCs, making it more apparent when you're being fired at + * This includes non-standard special effects like the .44 gap flash and the .35-800 ejector plume # Fixed * Potentially fixed yet another issue regarding crates -* Fixed battery socket `fillpercent` RoR function always assuming a max power of 1 \ No newline at end of file +* Fixed battery socket `fillpercent` RoR function always assuming a max power of 1 +* Fixed issue where multiblock ports would generate many OpenComputers component entries +* Fixed RBMK automatic control rods having incorrect settings when using the copy tool \ No newline at end of file diff --git a/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java b/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java index b59f8f56e..6cfd30654 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java +++ b/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java @@ -459,9 +459,9 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IItemHUD, I for(int i = 0; i < confNo; i++) { IHUDComponent[] components = gun.getConfig(stack, i).getHUDComponents(stack); + int bottomOffset = 0; if(components != null) for(IHUDComponent component : components) { - int bottomOffset = 0; component.renderHUDComponent(event, type, player, stack, bottomOffset, i); bottomOffset += component.getComponentHeight(player, stack); } diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java index 11896fab7..c341c8387 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java @@ -1,5 +1,7 @@ package com.hbm.items.weapon.sedna.factory; +import java.util.function.BiConsumer; + import com.hbm.interfaces.IOrderedEnum; import com.hbm.items.ItemEnumMulti; import com.hbm.items.ModItems; @@ -8,6 +10,8 @@ import com.hbm.items.weapon.sedna.Crosshair; import com.hbm.items.weapon.sedna.GunConfig; import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.Receiver; +import com.hbm.items.weapon.sedna.ItemGunBaseNT.GunState; +import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality; import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.lib.RefStrings; @@ -16,10 +20,12 @@ import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing.CasingType; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; public class GunFactory { public static BulletConfig ammo_debug; + public static BulletConfig ammo_debug_shot; public static SpentCasing CASING44 = new SpentCasing(CasingType.STRAIGHT).setScale(1.5F, 1.0F, 1.5F).setColor(SpentCasing.COLOR_CASE_44); @@ -32,6 +38,7 @@ public class GunFactory { /// BULLLET CFGS /// ammo_debug = new BulletConfig().setItem(ModItems.ammo_debug).setSpread(0.01F).setRicochetAngle(45).setCasing(CASING44.clone().register("DEBUG0")); + ammo_debug_shot = new BulletConfig().setItem(ModItems.ammo_debug).setSpread(0.05F).setProjectiles(6).setRicochetAngle(45).setCasing(CASING44.clone().register("DEBUG1")); /// GUNS /// ModItems.gun_debug = new ItemGunBaseNT(WeaponQuality.DEBUG, new GunConfig() @@ -40,9 +47,15 @@ public class GunFactory { .dmg(10F).delay(14).reload(46).jam(23).sound("hbm:weapon.44Shoot", 1.0F, 1.0F) .mag(new MagazineFullReload(0, 12).addConfigs(ammo_debug)) .offset(0.75, -0.0625, -0.3125D) - .canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE)) - .pp(Lego.LAMBDA_STANDARD_CLICK_PRIMARY).pr(Lego.LAMBDA_STANDARD_RELOAD).pt(Lego.LAMBDA_TOGGLE_AIM) - .decider(GunStateDecider.LAMBDA_STANDARD_DECIDER) + .canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE), + new Receiver(1) + .dmg(5F).delay(14).reload(46).jam(23).sound("hbm:weapon.44Shoot", 1.0F, 1.0F) + .mag(new MagazineFullReload(1, 12).addConfigs(ammo_debug_shot)) + .offset(0.75, -0.0625, -0.3125D) + .canFire(Lego.LAMBDA_SECOND_CAN_FIRE).fire(Lego.LAMBDA_SECOND_FIRE)) + .pp(Lego.LAMBDA_STANDARD_CLICK_PRIMARY).ps((stack, ctx) -> { Lego.clickReceiver(stack, ctx, 1); }) + .pr(Lego.LAMBDA_STANDARD_RELOAD).pt(Lego.LAMBDA_TOGGLE_AIM) + .decider(LAMBDA_DEBUG_DECIDER) .anim(Lego.LAMBDA_DEBUG_ANIMS) ).setUnlocalizedName("gun_debug"); @@ -79,6 +92,17 @@ public class GunFactory { MainRegistry.proxy.registerGunCfg(); } + public static BiConsumer LAMBDA_DEBUG_DECIDER = (stack, ctx) -> { + int index = ctx.configIndex; + GunState lastState = ItemGunBaseNT.getState(stack, index); + GunStateDecider.deciderStandardFinishDraw(stack, lastState, index); + GunStateDecider.deciderStandardClearJam(stack, lastState, index); + GunStateDecider.deciderStandardReload(stack, ctx, lastState, 0, index); + GunStateDecider.deciderStandardReload(stack, ctx, lastState, 1, index); + GunStateDecider.deciderAutoRefire(stack, ctx, lastState, 0, index, () -> { return ItemGunBaseNT.getPrimary(stack, index) && ItemGunBaseNT.getMode(stack, ctx.configIndex) == 0; }); + GunStateDecider.deciderAutoRefire(stack, ctx, lastState, 1, index, () -> { return ItemGunBaseNT.getSecondary(stack, index) && ItemGunBaseNT.getMode(stack, ctx.configIndex) == 0; }); + }; + public static enum EnumAmmo implements IOrderedEnum { STONE, STONE_AP, STONE_IRON, STONE_SHOT, M357_BP, M357_SP, M357_FMJ, M357_JHP, M357_AP, M357_EXPRESS, diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java index 29bf99834..cf9acc152 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java @@ -106,6 +106,7 @@ public class GunFactoryClient { //PROJECTILES ammo_debug.setRenderer(LegoClient.RENDER_STANDARD_BULLET); + ammo_debug_shot.setRenderer(LegoClient.RENDER_STANDARD_BULLET); stone.setRenderer(LegoClient.RENDER_STANDARD_BULLET); flint.setRenderer(LegoClient.RENDER_STANDARD_BULLET); @@ -238,7 +239,8 @@ public class GunFactoryClient { setRendererBulk(LegoClient.RENDER_GRENADE, shell_normal, shell_explosive, shell_ap, shell_du, shell_w9); //TODO: change the sabots //HUDS - ((ItemGunBaseNT) ModItems.gun_debug) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_debug) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO, LegoClient.HUD_COMPONENT_AMMO_SECOND); + ((ItemGunBaseNT) ModItems.gun_pepperbox) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_light_revolver) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_light_revolver_atlas) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/GunStateDecider.java b/src/main/java/com/hbm/items/weapon/sedna/factory/GunStateDecider.java index d30f91c85..a41c4fd6d 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/GunStateDecider.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/GunStateDecider.java @@ -20,7 +20,8 @@ public class GunStateDecider { /** * The meat and bones of the gun system's state machine. * This standard decider can handle guns with an automatic primary receiver, as well as one receiver's reloading state. - * It supports draw delays as well as semi and auto fire + * It supports draw delays as well as semi and auto fire with a standard left click refire check. + * Only handles single receiver weapons! */ public static BiConsumer LAMBDA_STANDARD_DECIDER = (stack, ctx) -> { int index = ctx.configIndex; diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/Lego.java b/src/main/java/com/hbm/items/weapon/sedna/factory/Lego.java index 094274b53..1fdf49add 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/Lego.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/Lego.java @@ -175,6 +175,7 @@ public class Lego { /** Returns true if the mag has ammo in it. Used by keybind functions on whether to fire, and deciders on whether to trigger a refire. */ public static BiFunction LAMBDA_STANDARD_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) > 0; }; + public static BiFunction LAMBDA_SECOND_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[1].getMagazine(stack).getAmount(stack, ctx.inventory) > 0; }; /** Returns true if the mag has ammo in it, and the gun is in the locked on state */ public static BiFunction LAMBDA_LOCKON_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) > 0 && ItemGunBaseNT.getIsLockedOn(stack); }; @@ -187,26 +188,29 @@ public class Lego { /** Spawns an EntityBulletBaseMK4 with the loaded bulletcfg */ public static BiConsumer LAMBDA_STANDARD_FIRE = (stack, ctx) -> { - doStandardFire(stack, ctx, GunAnimation.CYCLE, true); + doStandardFire(stack, ctx, GunAnimation.CYCLE, 0, true); + }; + public static BiConsumer LAMBDA_SECOND_FIRE = (stack, ctx) -> { + doStandardFire(stack, ctx, GunAnimation.CYCLE, 1, true); }; /** Spawns an EntityBulletBaseMK4 with the loaded bulletcfg, ignores wear */ public static BiConsumer LAMBDA_NOWEAR_FIRE = (stack, ctx) -> { - doStandardFire(stack, ctx, GunAnimation.CYCLE, false); + doStandardFire(stack, ctx, GunAnimation.CYCLE, 0, false); }; /** Spawns an EntityBulletBaseMK4 with the loaded bulletcfg, then resets lockon progress */ public static BiConsumer LAMBDA_LOCKON_FIRE = (stack, ctx) -> { - doStandardFire(stack, ctx, GunAnimation.CYCLE, true); + doStandardFire(stack, ctx, GunAnimation.CYCLE, 0, true); ItemGunBaseNT.setIsLockedOn(stack, false); }; - public static void doStandardFire(ItemStack stack, LambdaContext ctx, GunAnimation anim, boolean calcWear) { + public static void doStandardFire(ItemStack stack, LambdaContext ctx, GunAnimation anim, int receiver, boolean calcWear) { EntityLivingBase entity = ctx.entity; EntityPlayer player = ctx.getPlayer(); int index = ctx.configIndex; if(anim != null) ItemGunBaseNT.playAnimation(player, stack, anim, ctx.configIndex); boolean aim = ItemGunBaseNT.getIsAiming(stack); - Receiver primary = ctx.config.getReceivers(stack)[0]; + Receiver primary = ctx.config.getReceivers(stack)[receiver]; IMagazine mag = primary.getMagazine(stack); BulletConfig config = (BulletConfig) mag.getType(stack, ctx.inventory); diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/LegoClient.java b/src/main/java/com/hbm/items/weapon/sedna/factory/LegoClient.java index 4513341a7..2c493c353 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/LegoClient.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/LegoClient.java @@ -35,6 +35,7 @@ public class LegoClient { public static HUDComponentAmmoCounter HUD_COMPONENT_AMMO = new HUDComponentAmmoCounter(0); public static HUDComponentAmmoCounter HUD_COMPONENT_AMMO_MIRROR = new HUDComponentAmmoCounter(0).mirror(); public static HUDComponentAmmoCounter HUD_COMPONENT_AMMO_NOCOUNTER = new HUDComponentAmmoCounter(0).noCounter(); + public static HUDComponentAmmoCounter HUD_COMPONENT_AMMO_SECOND = new HUDComponentAmmoCounter(1); public static BiConsumer RENDER_STANDARD_BULLET = (bullet, interp) -> { double length = bullet.prevVelocity + (bullet.velocity - bullet.prevVelocity) * interp; diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory9mm.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory9mm.java index a24bee713..cbc10cf4a 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory9mm.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory9mm.java @@ -154,7 +154,7 @@ public class XFactory9mm { ItemGunBaseNT.setTimer(stack, index, primary.getDelayAfterFire(stack)); EntityDamageUtil.attackEntityFromNT(player, BulletConfig.getDamage(player, player, DamageClass.PHYSICAL), 1_000F, true, false, 1D, 5F, 0F); } else { - Lego.doStandardFire(stack, ctx, GunAnimation.CYCLE, true); + Lego.doStandardFire(stack, ctx, GunAnimation.CYCLE, 0, true); } }; diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFolly.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFolly.java index 1e1786917..d136236ee 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFolly.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFolly.java @@ -124,7 +124,7 @@ public class XFactoryFolly { }; public static BiConsumer LAMBDA_FIRE = (stack, ctx) -> { - Lego.doStandardFire(stack, ctx, GunAnimation.CYCLE, false); + Lego.doStandardFire(stack, ctx, GunAnimation.CYCLE, 0, false); }; public static BiFunction LAMBDA_CAN_FIRE = (stack, ctx) -> { diff --git a/src/main/java/com/hbm/items/weapon/sedna/hud/HUDComponentAmmoCounter.java b/src/main/java/com/hbm/items/weapon/sedna/hud/HUDComponentAmmoCounter.java index 90398bda4..63d1ac9a0 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/hud/HUDComponentAmmoCounter.java +++ b/src/main/java/com/hbm/items/weapon/sedna/hud/HUDComponentAmmoCounter.java @@ -41,7 +41,7 @@ public class HUDComponentAmmoCounter implements IHUDComponent { @Override public int getComponentHeight(EntityPlayer player, ItemStack stack){ - return 24; + return 19; } @Override @@ -52,7 +52,7 @@ public class HUDComponentAmmoCounter implements IHUDComponent { Minecraft mc = Minecraft.getMinecraft(); int pX = resolution.getScaledWidth() / 2 + (mirrored ? -(62 + 36 + 52) : (62 + 36)) + (noCounter ? 14 : 0); - int pZ = resolution.getScaledHeight() - bottomOffset - 23; + int pZ = resolution.getScaledHeight() - bottomOffset - 18; ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); IMagazine mag = gun.getConfig(stack, gunIndex).getReceivers(stack)[this.receiver].getMagazine(stack);