Skip to content

RussDev7/CastleForge-PumpkinGrenades

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

PumpkinGrenades

Restores the early CastleMiner Z pumpkin-themed grenade model from version 1.8.0 for regular grenades, sticky grenades, and thrown grenade projectiles.

Current mod version shown in source: 0.0.1.0

Preview

Circle Mode Square mode


Contents


Overview

PumpkinGrenades is a small CastleForge / ModLoader mod that restores the old pumpkin-themed grenade visuals from CastleMiner Z 1.8.0.

In that older version of the game, both the regular grenade and sticky grenade used a pumpkin grenade model loaded from:

Props\Weapons\Conventional\Grenade\Pumpkin\Model

Modern CastleMiner Z builds load the normal grenade model instead:

Props\Weapons\Conventional\Grenade\Model

This mod patches the newer game at runtime so the old pumpkin model can be used again without replacing the whole game content folder.


What this mod restores

PumpkinGrenades targets the important grenade visual paths:

Area Restored? Notes
Regular grenade inventory / held model Yes Replaces the inventory item class model.
Sticky grenade inventory / held model Yes Uses the same pumpkin model, matching CastleMiner Z 1.8.0.
Thrown grenade projectile model Yes Replaces GrenadeProjectile._grenadeModel.
Item icon render framing Yes Uses a UI-only Harmony patch to better center and scale the rendered icon.
Gameplay stats / explosion behavior No This is a visual restore, not a balance/gameplay rewrite.

Features at a glance

Feature What it does
Old pumpkin model restore Loads the old Pumpkin/Model.xnb from the mod asset folder.
Regular grenade support Applies the pumpkin model to InventoryItemIDs.Grenade.
Sticky grenade support Applies the pumpkin model to InventoryItemIDs.StickyGrenade.
Projectile support Applies the pumpkin model to thrown grenade projectile visuals.
Local ContentManager Loads model dependencies from !Mods\PumpkinGrenades\Assets.
HiDef fallback lookup Falls back to Content\HiDefContent for shared vanilla dependencies.
Icon framing patch Re-centers/rescales the pumpkin model when the game renders inventory icons.
No command dependency Runs automatically when loaded. No slash commands are required.

Requirements

PumpkinGrenades is built for the CastleForge ecosystem and requires:

  • CastleMiner Z
  • CastleForge ModLoader
  • Harmony through the mod's embedded resolver / CastleForge reference setup

Recommended target environment:

Item Recommended value
Game version 1.9.9.8
Framework CastleForge ModLoader
Mod version 0.0.1.0
Platform x86 / .NET Framework 4.8.1 project setup
ModLoaderExtensions Not required by this mod

Installation

  1. Install and verify CastleForge ModLoader.
  2. Build or download PumpkinGrenades.dll.
  3. Place the DLL in the CastleMiner Z !Mods folder.
  4. Add the required pumpkin grenade XNB assets under !Mods\PumpkinGrenades\Assets.
  5. Launch the game.
  6. Check the ModLoader log for successful model application messages.

Expected DLL placement:

CastleMiner Z\!Mods\PumpkinGrenades.dll

Expected mod asset folder:

CastleMiner Z\!Mods\PumpkinGrenades\Assets\

Depending on your packaging flow, the DLL may sit directly in !Mods, while the asset folder lives under !Mods\PumpkinGrenades\.


Required asset layout

For the restored 1.8.0 pumpkin grenade model, use this layout:

CastleMiner Z\
└─ !Mods\
   ├─ PumpkinGrenades.dll
   └─ PumpkinGrenades\
      └─ Assets\
         ├─ Newpumpkingrenade_0.xnb
         ├─ 1024pumpkingrenadetex2GLOWXTREME_0.xnb
         ├─ PropShader_hidef_0.xnb
         └─ Pumpkin\
            └─ Model.xnb

Required files

File Purpose
Assets\Pumpkin\Model.xnb Old pumpkin grenade model.
Assets\Newpumpkingrenade_0.xnb Main pumpkin grenade texture dependency.
Assets\1024pumpkingrenadetex2GLOWXTREME_0.xnb Glow/second-material texture dependency used by the model.
Assets\PropShader_hidef_0.xnb Effect dependency requested by the old model. The loader can also fall back to the installed game's Content\HiDefContent copy if present.

The extracted PNG names are not enough for model loading. XNA model dependencies need processed .xnb files with the names the model requests.


How it works

PumpkinGrenades applies two main runtime changes.

Projectile model patch

The mod patches:

DNA.CastleMinerZ.GrenadeProjectile.Init()

After the vanilla game initializes grenade projectile content, the mod replaces the static projectile model field:

GrenadeProjectile._grenadeModel

This affects thrown grenade visuals.

Inventory item model patch

The mod patches:

DNA.CastleMinerZ.Inventory.InventoryItem.Initalize(ContentManager)

After vanilla item classes are registered, the mod replaces the protected model field on the grenade item classes:

ModelInventoryItemClass._model

This affects regular grenade and sticky grenade inventory / held item visuals.

Icon framing patch

The game renders model-based inventory icons from temporary item entities. The old pumpkin model has different bounds/origin than the newer grenade model, so the icon can appear too small, off-center, or clipped.

PumpkinGrenades includes UI-only CreateEntity(..., ItemUse.UI, ...) patches for grenade item classes so the rendered icon can be centered and scaled independently from the physical world model.


Behavior notes

Regular and sticky grenades use the same pumpkin model

This matches CastleMiner Z 1.8.0. The old game registered both regular grenades and sticky grenades with the same pumpkin grenade model.

The two pumpkin texture files are not separate regular/sticky textures. They are texture dependencies used by the same model, likely a main material plus a glow/secondary material.

This is a visual restore

PumpkinGrenades does not change:

  • grenade damage,
  • explosion radius,
  • sticky behavior,
  • recipes,
  • inventory IDs,
  • multiplayer packet formats.

Multiplayer

This is primarily a client-side visual mod. Players without the mod should still be able to play, but they will see their own local grenade visuals.

For consistent visuals, all players should install the same mod and asset set.


Troubleshooting

Log says Missing XNB dependency requested by model: PropShader_hidef_0

Add this file to the asset folder:

!Mods\PumpkinGrenades\Assets\PropShader_hidef_0.xnb

or make sure the installed game has:

Content\HiDefContent\PropShader_hidef_0.xnb

Log says Missing XNB dependency requested by model: Newpumpkingrenade_0

Add:

!Mods\PumpkinGrenades\Assets\Newpumpkingrenade_0.xnb

Log says Missing XNB dependency requested by model: 1024pumpkingrenadetex2GLOWXTREME_0

Add:

!Mods\PumpkinGrenades\Assets\1024pumpkingrenadetex2GLOWXTREME_0.xnb

The mod loads, but the icon is off-center or clipped

Tune the icon transform values in the grenade UI icon patch:

float iconSize = isSticky ? 28.0f : 48.0f;
float offsetX = isSticky ? 0.0f : 0.0f;
float offsetY = isSticky ? 0.0f : 0.0f;

Helpful tuning direction:

Problem Adjustment
Icon too small Increase iconSize.
Icon too large / clipped Decrease iconSize.
Too far left Increase offsetX.
Too far right Decrease offsetX.
Too low Increase offsetY.
Too high Decrease offsetY.

Restart the game or reset the item icon atlas after tuning, because the game caches rendered item icons.

The physical grenade looks correct, but the item icon still looks wrong

The physical world/held model and the inventory icon are different render paths. The world model can be correct while the icon still needs UI transform tuning.

Both grenade icons use the same scale

Check which CreateEntity patch is actually being hit in the log. Sticky grenade icon generation may go through a different class path depending on the game build. Add temporary logging around the patch to print the item class type and item ID.


Development notes

Important files:

PumpkinGrenades.cs
PumpkinGrenadeModelLoader.cs
Patching\GamePatches.cs

Important runtime hooks:

GrenadeProjectile.Init()
InventoryItem.Initalize(ContentManager)
GrenadeInventoryItemClass.CreateEntity(...)
StickyGrenadeInventoryItemClass.CreateEntity(...)

Important runtime fields:

GrenadeProjectile._grenadeModel
ModelInventoryItemClass._model

The mod uses a folder-rooted ContentManager so the old model can load dependencies from the mod folder instead of requiring files to be placed directly in the game's content directory.


Credits

  • RussDev7 - CastleForge / PumpkinGrenades mod implementation.
  • CastleForge ModLoader - runtime mod loading and Harmony patch support.
  • DigitalDNA Games / CastleMiner Z - original CastleMiner Z game and historical pumpkin grenade assets.

About

CastleForge mod that restores the old pumpkin grenade model from CastleMiner Z 1.8.0.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages