Gun Firing Ammunition and Inventory Pitfalls 1.12.2 - Herbertofury/Advent-of-Ascension GitHub Wiki

Home · Historical gun inputs · Crafting

Historical gun firing, ammunition and inventory pitfalls

Minecraft 1.12.2 / AoA 3.3.6. This is a released-code operating reference and a set of independent inventory arithmetic tests. It is not a live-game test or a promise that every gun uses the same ammunition.

Historical 16-bullet recipe, firing checks and a modeled split-stack consumption warning

Craft ordinary Limonite Bullets

Place one Limonite Ingot directly above one Gunpowder in the shaped recipe. It produces 16 Limonite Bullets in this release. The ingredients use exact item IDs, not a broad ingot tag. Do not copy the modern 48-bullet yield into the historical recipe.

Open the exact historical recipe.

When the base gun will fire

The selected base right-click method checks these gates before its server ammunition call:

  1. Correct hand: Brace enchantment level above zero selects the offhand; otherwise the main hand is selected. A click from the other hand fails this method.
  2. Blocking: actively using an item while blocking returns PASS rather than firing through this branch.
  3. Sneaking offhand conflict: when sneaking with the gun in the offhand, a main-hand BaseSniper or BaseStaff causes a failure return.
  4. Attack strength: the player must have a cooled attack strength of at least 1.
  5. Server ammunition result: a non-null projectile from findAndConsumeAmmo is required for the successful-use branch.

This describes the inspected base method. Subclasses, other mods and engine cooldown handling can introduce additional behavior. A FAIL or PASS result alone is not a diagnosis of missing ammunition.

Which guns inherit the ordinary ammunition method?

Of the 78 direct gun registrations inspected, 45 inherit BaseGun.findAndConsumeAmmo. That method requests Limonite Bullets through the shared inventory helper, with an amount of 1 + Greed enchantment level. Its Creative helper bypass does not require the ordinary stock deduction.

The other 33 declare a different ammunition method. An override may change the projectile, payment or both. Its presence does not by itself prove a different ammo item. The table below makes the method boundary explicit instead of assigning the Limonite rule to every weapon.

Gun and portrait Released ammunition-method owner
Abominator BaseGun · Limonite helper path
Apoco Assault Rifle ApocoAssaultRifle · override, inspect separately
Apoco Rifle ApocoRifle · override, inspect separately
Aqua Magnum BaseGun · Limonite helper path
Artifact BaseGun · Limonite helper path
Baronator Baronator · override, inspect separately
Bayonette Rifle BaseGun · Limonite helper path
Big Top BaseGun · Limonite helper path
Blood Iron BloodIron · override, inspect separately
Chain Wrecker BaseGun · Limonite helper path
Chilli Chugger ChilliChugger · override, inspect separately
Clownershot Clownershot · override, inspect separately
Construct BaseGun · Limonite helper path
Coral Clogger CoralClogger · override, inspect separately
Core Rifle BaseGun · Limonite helper path
Crystal Carver BaseGun · Limonite helper path
Cyclone Cyclone · override, inspect separately
Darkener BaseGun · Limonite helper path
Dart Gun DartGun · override, inspect separately
Destruction Rifle BaseGun · Limonite helper path
Discharge Rifle DischargeRifle · override, inspect separately
Draco BaseGun · Limonite helper path
Dragilator Dragilator · override, inspect separately
Dustometer Dustometer · override, inspect separately
Echo Gull BaseGun · Limonite helper path
Electinator Electinator · override, inspect separately
Flame Wrecker FlameWrecker · override, inspect separately
Flaming Fury FlamingFury · override, inspect separately
Floro Rifle BaseGun · Limonite helper path
Flower's Fury BaseGun · Limonite helper path
Frosticator Frosticator · override, inspect separately
Gardener Gardener · override, inspect separately
Gauge Rifle GaugeRifle · override, inspect separately
Germinator Germinator · override, inspect separately
Golden Fury GoldenFury · override, inspect separately
Happy Haunter BaseGun · Limonite helper path
Haunter Rifle BaseGun · Limonite helper path
Heat Wave HeatWave · override, inspect separately
Hiver BaseGun · Limonite helper path
Hot Shot HotShot · override, inspect separately
Hunter's Rifle BaseGun · Limonite helper path
Iominator Iominator · override, inspect separately
Ion Revolver BaseGun · Limonite helper path
Iro Rifle BaseGun · Limonite helper path
Krilinator BaseGun · Limonite helper path
Light Iron LightIron · override, inspect separately
Lunar Assault Rifle BaseGun · Limonite helper path
Mechanical Assault Rifle BaseGun · Limonite helper path
Megagun BaseGun · Limonite helper path
Miasma BaseGun · Limonite helper path
Minigun BaseGun · Limonite helper path
Mint Magnum BaseGun · Limonite helper path
MK BaseGun · Limonite helper path
MK-Fung MKFung · override, inspect separately
Nethenette Rifle NethenetteRifle · override, inspect separately
Nethengeic Slugger NethengeicSlugger · override, inspect separately
Overshot Overshot · override, inspect separately
Precasian Slugger PrecasianSlugger · override, inspect separately
Predator BaseGun · Limonite helper path
Predigun Predigun · override, inspect separately
Pulsator BaseGun · Limonite helper path
Purity Rifle BaseGun · Limonite helper path
Rocker Rifle BaseGun · Limonite helper path
Roulette BaseGun · Limonite helper path
Shoe Flinger ShoeFlinger · override, inspect separately
Skullette BaseGun · Limonite helper path
Skullifact BaseGun · Limonite helper path
Spectacle BaseGun · Limonite helper path
Spine Gun BaseGun · Limonite helper path
Squad Gun BaseGun · Limonite helper path
Stampede BaseGun · Limonite helper path
Stormer BaseGun · Limonite helper path
Sublimus Sublimus · override, inspect separately
Tiger Tommy BaseGun · Limonite helper path
Tommy BaseGun · Limonite helper path
Vile Vanquisher BaseGun · Limonite helper path
Wart Gun WartGun · override, inspect separately
Wrecker BaseGun · Limonite helper path

Recoil and successful-use ordering

The selected base shot path applies the Control multiplier 1 − 0.15 × Control level to getRecoilForShot. The offhand packet receives an additional ×2.5. These are inspected arithmetic operations, not degrees, guaranteed camera movement or a recommendation to inject out-of-range enchantment levels.

The ammunition method runs before the projectile spawn attempt. When it returns a projectile, the base method calls spawnEntity, then records item use, applies the firing-delay cooldown, damages the gun by 1 and handles sound/recoil. The spawn method's boolean result is discarded by this caller.

Therefore a rejected spawn is a target-build regression case: the inspected caller does not establish a rollback of already-consumed ammunition or subsequent durability/cooldown changes. Do not batch expensive shots while diagnosing a spawn failure.

Split-stack accounting: a real source-level warning

For a requested amount greater than one, the released shared helper collects matching stack references and totals foundCount. It checks that the collected count reaches the request. During consumption, however, it repeatedly computes the minimum of the current stack count, the original requested amount, and foundCount. It decreases foundCount, but does not decrease a separate remaining-request amount or stop when that request has been paid.

An independent model of that exact loop gives:

Starting matching stacks Requested amount Modeled removal Correct exact-payment target
2 and 2, separate main-inventory stacks 3 4 3
1 and 5, separate main-inventory stacks 3 4 3
3 and 5, separate main-inventory stacks 3 3 3

The third case stops collecting after the first sufficient stack, so it does not demonstrate the error. This is why a simple test with one large stack can miss the boundary problem.

The helper also examines the main-hand stack before iterating main inventory. In the modeled multi-item path, a matching selected stack can be added a second time as the same object. A single selected matching item with a request of 2 can satisfy the counted total through duplication while only one physical item is removed. This is a bookkeeping test case, not a claim that every weapon setup exposes the same behavior.

The included 201 models cover matching main-inventory objects, requests above one, non-Creative mode and consumption enabled. They are independent Python models of the inspected algorithm, not executed Minecraft sessions. The amount-one path, offhand/armor search and custom mod inventories need their own runtime tests.

Practical caution

When testing a gun with a multi-item cost, start with a small known amount, compare the physical inventory before and after each attempt, and avoid relying on several small matching stacks. Keep valuable reserves out of the tested inventory while diagnosing a discrepancy. A pack may already patch this helper, so verify the actual target build before reporting the behavior as reproduced there.

Matching is stricter than the display name

The inspected equality helper compares item identity, damageability, metadata for non-damageable items, and tag presence/content. A renamed or otherwise tagged stack is not automatically equivalent to the untagged template used by the base ammo call. This path does not scan arbitrary nested backpacks.

Restoration and performance test checklist

  • Deduplicate physical stack references before counting them. Test the selected main-hand stack appearing again in main inventory.
  • Check sufficient unique stock before consuming, then maintain a remaining amount and stop at zero. Test exact payment, split stacks and insufficient stock without partial loss.
  • Separate item consumption from projectile acceptance; define and test failure handling rather than assuming the spawn attempt succeeded.
  • Preserve Creative behavior, item metadata/tags, hand selection, cooldowns and custom gun overrides when changing the shared helper.
  • The inspected base impact method contains a System.out.println(target) call. Treat uncontrolled per-impact console output as a profiling candidate; removing or gating it is not a measured FPS improvement by this documentation pass.
  • Recheck Control/Brace behavior, server/client agreement, save/reload and modded inventories. Do not claim no regression from arithmetic unit models alone.

Released method evidence, 78 method-owner resolutions, recipe and 201 inventory models · Source icon provenance.