<?xml version="1.0"?>
<rss version="2.0"><channel><title>Modder Support Latest Topics</title><link>https://forums.minecraftforge.net/forum/70-modder-support/</link><description>Modder Support Latest Topics</description><language>en</language><item><title>[1.20.1] why is chunk.getHeight returning -64</title><link>https://forums.minecraftforge.net/topic/160607-1201-why-is-chunkgetheight-returning-64/</link><description><![CDATA[<pre spellcheck="" class="ipsCode language-java" data-language="Java"><code>@SubscribeEvent
public void onChunkLoad(ChunkEvent.Load event) {
    if (!(event.getLevel() instanceof Level level) || !event.isNewChunk()) return;

    if (level.isClientSide()) {
        ChunkAccess chunk = event.getChunk();
        ChunkPos pos = chunk.getPos();
        Vector2i coordinatesToWorld = new Vector2i(pos.x * 16, pos.z * 16);
        Vector2i chunk_origin = new Vector2i(
                Math.floorMod(coordinatesToWorld.x, 512),
                Math.floorMod(coordinatesToWorld.y, 512)
        );
        Vector2i region_coordinates = new Vector2i(
                pos.getRegionX(),
                pos.getRegionZ()
        );
        int[] colors_data = new int[256];

        for (int z = 0; z &lt; 16; z++) {
            for (int x = 0; x &lt; 16; x++)
            {
                int highestY = chunk.getHeight(
                        Heightmap.Types.MOTION_BLOCKING_NO_LEAVES,
                        x,
                        z
                );

                BlockPos blockPos = pos.getBlockAt(x, highestY-1, z);
                BlockState state = level.getBlockState(blockPos);
                int colorsValue = getColorsValue(state);

                System.out.println("block: " + state.getBlock() + ", height: " + highestY);

                colors_data[z * 16 + x] = colorsValue;
            }
        }

        MinecraftServer server = ServerLifecycleHooks.getCurrentServer();

        if (server != null) {
            ExampleMod.MOD_FOLDER.AttemptToModifyRegionArea(
                    chunk_origin.x,
                    chunk_origin.y,
                    16,
                    16,
                    colors_data,
                    new RegionRecord(
                            level.dimension().location().toString(),
                            server.getWorldData().getLevelName(),
                            region_coordinates
                    )
            );
        }
    }
}</code></pre>]]></description><guid isPermaLink="false">160607</guid><pubDate>Thu, 22 Oct 2026 17:38:59 +0000</pubDate></item><item><title>How to make recipes contain NBT data in forge 1.20.1?</title><link>https://forums.minecraftforge.net/topic/160536-how-to-make-recipes-contain-nbt-data-in-forge-1201/</link><description><![CDATA[<p>For a detailed explanation, I'm making a mod that is going to have craft-able Enchanted Books (among many other things).<br><br>I want to be able to craft books in a crafting table, but I can't seem to either<br><br>1) Hardcode an item to be enchanted a certain way. I can only get it to "be enchanted" with a glimmer effect.</p><p></p><p>or</p><p></p><p>2) Add NBT data to crafting recipes, as this functionality was only natively supported by Minecraft in 1.20.5 (if i'm remember the version number correctly)<br><br><br>If anyone could assist with this it would be greatly appreciated. Thank you.</p>]]></description><guid isPermaLink="false">160536</guid><pubDate>Wed, 09 Sep 2026 20:48:39 +0000</pubDate></item><item><title>GeckoLib 5.0 model texture not loading in Forge 1.20.1 with GeckoLib 4.x</title><link>https://forums.minecraftforge.net/topic/160015-geckolib-50-model-texture-not-loading-in-forge-1201-with-geckolib-4x/</link><description><![CDATA[<p>Hello! I’m having an issue: the texture of my animated block is not showing when using GeckoLib in a Forge 1.20.1 mod. I’m confident that the texture path is correct: <code>assets/reignofnether/textures/block/vilka.png</code>. The model was created in GeckoLib 5.0 (Blockbench), but the project uses GeckoLib 4.x, so I suspect the issue is incompatibility between the .geo.json format of GeckoLib 5.0 and the API of GeckoLib 4.x: layer/texture structure has changed, preventing the engine from finding the file. Could you please advise: 1) How to properly adapt a GeckoLib 5.0 model + texture to work in 4.x? 2) Should the texture path in <code>getTextureResource</code> include the <code>.png</code> extension? 3) What are the main structural differences in JSON between GeckoLib 5.0 and 4.x models? I can attach logs, folder structure, and the model upon request.</p>]]></description><guid isPermaLink="false">160015</guid><pubDate>Wed, 08 Apr 2026 18:02:03 +0000</pubDate></item><item><title>How can I learn Forge modding?</title><link>https://forums.minecraftforge.net/topic/160487-how-can-i-learn-forge-modding/</link><description><![CDATA[<p>Genuine question: How am I supposed to learn Forge?</p><p></p><p>Right now, I'm trying to make a rather small mod for a custom server me and my friends are making, but I'm struggling quite a lot to learn Forge. I find the documentation quite lacking and it feels weird that I can't even find a list of Forge's event. Yeah sure, there are tutorials to do things in Forge, but if I want to do something that isn't specifically what the tutorial does, I'm screwed.</p><p>I've been able to progress the mod, but I find myself forced to use quite a lot of AI to ask how should I do things, which I don't like.</p><p></p><p>I must also mention that I have experience with coding, so even though I might not be a very experienced programmer, I don't believe my coding skills are the thing that it's holding me back, but rather the lack of Forge knowledge.</p><p></p><p>So, experienced Forge modders, how did you learn to use Forge and modding?</p>]]></description><guid isPermaLink="false">160487</guid><pubDate>Mon, 17 Aug 2026 16:41:29 +0000</pubDate></item><item><title>[1.8.9] Why is my item not initializing?</title><link>https://forums.minecraftforge.net/topic/160496-189-why-is-my-item-not-initializing/</link><description><![CDATA[<p>So I'm new to mod development, and I'm following <a rel="external nofollow" href="https://www.youtube.com/watch?v=N4CGw-qnwSU&amp;list=PLpKu3PfwdqHQc5F3YnUdBm3rOyfLke3sj&amp;index=2">this tutorial</a>, and I cant seem to figure out why the item isn't being initialized. I followed the code exactly as the video says, but the game just isnt initializing the item as far as i can tell. </p><p></p><p>This is the contents of my <a rel="external nofollow" href="https://ModItems.java">ModItems.java</a> file:</p><p><code>package notrainbowsteve.mcap.init;</code></p><p><code>import net.minecraft.item.Item;</code></p><p><code>import net.minecraftforge.fml.common.registry.GameRegistry;</code></p><p><code>public class ModItems {</code></p><p><code>	</code></p><p><code>	public static Item copper_ingot;</code></p><p><code>	</code></p><p><code>	public static void init() {</code></p><p><code>		copper_ingot = new Item().setUnlocalizedName("copper_ingot");</code></p><p><code>	}</code></p><p><code>	</code></p><p><code>	public static void register() {</code></p><p><code>		registerItem(copper_ingot);</code></p><p><code>	}</code></p><p><code>	</code></p><p><code>	public static void registerItem(Item item) {</code></p><p><code>		GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));</code></p><p><code>		System.out.println("Registered Item: " + item.getUnlocalizedName().substring(5));</code></p><p><code>	}</code></p><p><code>}</code></p><p></p><p>it might be worth noting that I'm not entirely sure what the <code>.substring(5)</code> part under <code>registerItem</code> actually means, specifically the number being used. I think I understand what the substring part means, but I'm not entirely sure on what the 5 means.</p><p></p><p>this is the contents of my main .java file (called <a rel="external nofollow" href="https://MCAP.java">MCAP.java</a>):</p><p><code>package notrainbowsteve.mcap;</code></p><p><code>import net.minecraftforge.fml.common.Mod;</code></p><p><code>import net.minecraftforge.fml.common.SidedProxy;</code></p><p><code>import net.minecraftforge.fml.common.Mod.EventHandler;</code></p><p><code>import net.minecraftforge.fml.common.event.FMLInitializationEvent;</code></p><p><code>import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;</code></p><p><code>import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;</code></p><p><code>@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION)</code></p><p><code>public class MCAP {</code></p><p><code>	</code></p><p><code>	@SidedProxy(serverSide = Reference.SERVER_PROXY_CLASS, clientSide = Reference.CLIENT_PROXY_CLASS)</code></p><p><code>	public static CommonProxy proxy;</code></p><p><code>	</code></p><p><code>	@Mod.Instance("mcap")</code></p><p><code>	public static MCAP instance;</code></p><p><code>	</code></p><p><code>	@EventHandler()</code></p><p><code>	public static void preInit(FMLPreInitializationEvent event) {</code></p><p><code>		ModItems.init();</code></p><p><code>		ModItems.register();</code></p><p><code>	}</code></p><p><code>	</code></p><p><code>	@EventHandler</code></p><p><code>	public static void init(FMLInitializationEvent event) {</code></p><p><code>		proxy.registerRenders();</code></p><p><code>	}</code></p><p><code>	</code></p><p><code>	@EventHandler</code></p><p><code>	public static void postInit(FMLPostInitializationEvent event) {</code></p><p><code>		</code></p><p><code>	}</code></p><p><code>}</code></p><p></p><p></p><p></p><p>if I need to give more info, im more than glad to do so if it means i can get this working. </p>]]></description><guid isPermaLink="false">160496</guid><pubDate>Sat, 22 Aug 2026 20:40:18 +0000</pubDate></item><item><title>How do I make my biped mob always spawn with a pumpkin head? [1.16.5]</title><link>https://forums.minecraftforge.net/topic/160492-how-do-i-make-my-biped-mob-always-spawn-with-a-pumpkin-head-1165/</link><description><![CDATA[<p>How do I make my biped mob always spawn with a pumpkin head? I'm on 1.16.5</p>]]></description><guid isPermaLink="false">160492</guid><pubDate>Thu, 20 Aug 2026 11:03:54 +0000</pubDate></item><item><title>[SOLVED] Register BlockEntity in 1.19.2</title><link>https://forums.minecraftforge.net/topic/118291-solved-register-blockentity-in-1192/</link><description><![CDATA[
<p>
	I'm trying to register a BlockEntity but IntelliJ says " Connot resolve method 'of(&lt;method reference&gt;, Block)' ". Here is my code:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted"><span class="pln">public static final RegistryObject&lt;BlockEntityType</span><span class="tag">&lt;MobKillerBE&gt;</span><span class="pln">&gt; MOB_KILLER_BE =
            BLOCK_ENTITIES.register("mob_killer", () -&gt;
                    BlockEntityType.Builder.of(MobKillerBE::new,
                            MOB_KILLER.get()).build(null));</span></pre>

<p>
	MobKillerBE definition:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted"><span class="pln">public class MobKillerBE extends BlockEntity</span></pre>

<p>
	MOB_KILLER definition:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted"><span class="pln">public static final RegistryObject</span><span class="tag">&lt;Block&gt;</span><span class="pln"> MOB_KILLER = BLOCKS.register("mob_killer", () -&gt; new MobKiller(BlockBehaviour.Properties.of(Material.STONE)));</span></pre>

<p>
	I'm using this tutorial: <a href="https://moddingtutorials.org/o19/tile-entities" rel="external nofollow">https://moddingtutorials.org/o19/tile-entities</a>
</p>

]]></description><guid isPermaLink="false">118291</guid><pubDate>Tue, 15 Nov 2022 16:50:32 +0000</pubDate></item><item><title>My custom chests ive been coding in briefly close then open when i right click on them and open the menu.</title><link>https://forums.minecraftforge.net/topic/160456-my-custom-chests-ive-been-coding-in-briefly-close-then-open-when-i-right-click-on-them-and-open-the-menu/</link><description><![CDATA[<p>Im coding a custom chest, and i want it to work exactly like the vanilla chest but with a custom ui, but for some reason when i open the chest the lid opens then immediately shuts while im still in the ui.</p>]]></description><guid isPermaLink="false">160456</guid><pubDate>Thu, 06 Aug 2026 01:15:31 +0000</pubDate></item><item><title>Recipes not working</title><link>https://forums.minecraftforge.net/topic/160445-recipes-not-working/</link><description><![CDATA[<blockquote data-ipsquote-timestamp="1706701721" data-ipsquote-userid="152291" data-ipsquote-username="vemerion" data-ipsquote-contentapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentclass="forums_Topic" data-ipsquote-contentid="144321" data-ipsquote-contentcommentid="565386" class="ipsQuote" cite="" data-ipsquote=""><header class="ipsQuote_citation">On 1/31/2024 at 6:48 AM, vemerion said:</header><div class="ipsQuote_contents" data-ipstruncate=""><p>No problem! Glad I could help <img src="https://forums.minecraftforge.net/uploads/emoticons/smile.png" alt=":)" title=":)" class="ipsRichText__align--block" width="20" height="20" loading="lazy"></p></div></blockquote><p>I also have this same issue, but im not the most technical guy out there, so im super confused, i just wanted the camera mod to work like how Auromancy has his camera mod in his The Broken Script series</p>]]></description><guid isPermaLink="false">160445</guid><pubDate>Wed, 29 Jul 2026 03:21:11 +0000</pubDate></item><item><title>Forge 1.20.1 World Generation Architecture Review &#x2014; Dynamic Rising Sea Level System</title><link>https://forums.minecraftforge.net/topic/160438-forge-1201-world-generation-architecture-review-dynamic-rising-sea-level-system/</link><description><![CDATA[<h1>Forge 1.20.1 World Generation Architecture Review — Dynamic Rising Sea Level System</h1><p>Hello. I am developing a Forge 1.20.1 mod called <strong>World FloodEnd</strong>.</p><p>The core mechanic of the mod is a gradually rising global ocean level.</p><p>Every 5 in-game days the global water level increases by 1 block.</p><p>Example:</p><pre spellcheck="" class="ipsCode" data-language="text"><code>Day 0:  Sea level Y=63
Day 5:  Sea level Y=64
Day 10: Sea level Y=65
...
</code></pre><p>The main challenge is performance.</p><p>I do <strong>not</strong> want to use the common approach:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>Increase water level
        |
        v
Scan the entire world
        |
        v
Place millions of water blocks
</code></pre><p>because this will eventually destroy TPS on large worlds.</p><p>The goal is to make the rising ocean behave like a world generation parameter, not like a giant block update operation.</p><hr><h2>Intended architecture</h2><p>The world should have a global value:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>FloodLevel = current ocean height
</code></pre><p>This value is stored by the mod and increases every 5 Minecraft days.</p><p>The system is divided into three cases:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>                     FloodWorldData
                           |
                           |
                    Current FloodLevel
                           |
          ┌────────────────┼────────────────┐
          |                |                |
          v                v                v

 New unexplored       Loaded chunks       Unloaded chunks

 chunks               around players      stored on disk


 World generation     FloodManager        No processing
 uses current         handles gradual     while inactive
 FloodLevel           flooding

</code></pre><hr><h1>1. New unexplored chunks</h1><p>When a player travels into unexplored territory, the chunk should already generate with the current ocean level.</p><p>Example:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>Day 100
FloodLevel = Y=100

Player travels far away

New chunks should generate already matching Y=100
</code></pre><p>The goal is:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>Chunk generation
        |
        v
Current FloodLevel applied
        |
        v
Chunk appears already flooded
</code></pre><p>Not:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>Generate chunk
        |
        v
Place thousands of water blocks afterwards
</code></pre><p>because that causes huge performance spikes.</p><hr><p>Currently I am investigating the world generation stage.</p><p>I created a Mixin into:</p><pre spellcheck="" class="ipsCode language-java" data-language="Java"><code>NoiseBasedChunkGenerator.fillFromNoise()
</code></pre><p>Example:</p><pre spellcheck="" class="ipsCode language-java" data-language="Java"><code>@Inject(method = "fillFromNoise", at = @At("HEAD"))
private void worldFloodEnd$fillFromNoise(
        Executor executor,
        Blender blender,
        RandomState randomState,
        StructureManager structureManager,
        ChunkAccess chunk,
        CallbackInfoReturnable&lt;CompletableFuture&lt;ChunkAccess&gt;&gt; cir
)
{
    int waterLevel = FloodWorldData.getWaterLevel();

    WorldFloodEnd.LOGGER.info(
        "[WorldFloodEnd] New chunk {} {} | Water Level {}",
        chunk.getPos().x,
        chunk.getPos().z,
        waterLevel
    );
}
</code></pre><p>However, this is currently only for testing.</p><p>The idea is not to manually place water inside this method.</p><p>The intended solution is to make the generator itself use the current FloodLevel.</p><p>Possible approaches I am considering:</p><ul><li><p>dynamically replacing <code>NoiseGeneratorSettings.seaLevel</code>;</p></li><li><p>overriding <code>ChunkGenerator#getSeaLevel()</code> through Mixin;</p></li><li><p>another Forge-supported world generation hook.</p></li></ul><hr><h1>2. Already generated and currently loaded chunks</h1><p>These chunks are handled differently.</p><p>A separate <code>FloodManager</code> should only work with chunks that are currently loaded around players.</p><p>Example:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>Player base area loaded

        |
        v

FloodManager gradually updates these chunks

        |
        v

Water level increases smoothly
</code></pre><p>The FloodManager should:</p><ul><li><p>process only active chunks;</p></li><li><p>use a limited queue;</p></li><li><p>avoid large TPS spikes;</p></li><li><p>never scan the whole world.</p></li></ul><p>The goal is that the player sees the ocean slowly advancing, while the server remains stable.</p><hr><h1>3. Previously generated but unloaded chunks</h1><p>This is an important part.</p><p>I do not want unloaded chunks to be constantly processed.</p><p>Example:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>Day 100
FloodLevel = Y=100

Chunk was generated years ago
Player leaves
Chunk unloads

↓

No background flooding process
</code></pre><p>Later:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>Player returns

↓

Chunk loads again

↓

Chunk should know the current FloodLevel

↓

It updates to the correct state
</code></pre><p>The world should not require a full scan after every ocean level increase.</p><hr><h1>Desired final behavior</h1><p>The complete system should work like this:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>Every 5 days:

FloodLevel +1

        |

        |

New chunks:
generated with new water height


Loaded chunks:
FloodManager gradually updates them


Unloaded chunks:
wait until loaded again, then synchronize
</code></pre><hr><h1>Questions for experienced Forge developers</h1><p>I would appreciate feedback on the architecture before continuing development.</p><ol><li><p>Is using dynamic <code>NoiseGeneratorSettings.seaLevel</code> the correct approach for making new chunks generate with a higher ocean level?</p></li><li><p>Is <code>NoiseBasedChunkGenerator.fillFromNoise()</code> a good place to hook into, or is there a better generation stage?</p></li><li><p>Would overriding <code>ChunkGenerator#getSeaLevel()</code> with Mixin be safe, or could it create compatibility issues with other world generation mods?</p></li><li><p>What is the recommended Forge approach for unloaded chunks:</p><ul><li><p>storing a FloodLevel value in chunk NBT?</p></li><li><p>using capabilities?</p></li><li><p>another chunk lifecycle event?</p></li></ul></li><li><p>Could this approach interfere with:</p><ul><li><p>structures;</p></li><li><p>villages;</p></li><li><p>custom terrain generators;</p></li><li><p>biome generation mods;</p></li><li><p>aquifers?</p></li></ul></li><li><p>Is the architecture:</p></li></ol><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>Generation modification for new chunks
+
FloodManager for active chunks
+
state synchronization for unloaded chunks
</code></pre><p>a reasonable way to implement a dynamic rising ocean without destroying server performance?</p><p>Environment:</p><ul><li><p>Minecraft Forge 1.20.1</p></li><li><p>Java 17</p></li></ul><p>I am not asking for a complete implementation. I mainly want an architecture review from people familiar with Minecraft world generation and Forge internals.</p><p>Thank you.</p>]]></description><guid isPermaLink="false">160438</guid><pubDate>Tue, 28 Jul 2026 12:50:54 +0000</pubDate></item><item><title>How to change a players selected hotbar slot</title><link>https://forums.minecraftforge.net/topic/95827-how-to-change-a-players-selected-hotbar-slot/</link><description><![CDATA[<p>
	I am trying to change the players currently selected hotbar slot. I found 
</p>

<pre class="ipsCode prettyprint lang-c prettyprinted">
<span class="pln">minecraft</span><span class="pun">.</span><span class="pln">thePlayer</span><span class="pun">.</span><span class="pln">inventory</span><span class="pun">.</span><span class="pln">changeCurrentItem</span><span class="pun">(</span><span class="pln">x</span><span class="pun">)</span></pre>

<p>
	however, this only selects the next or previous slot.
</p>

<p>
	I am very new to this, sorry if I missed something obvious.
</p>

<p>
	Thanks.
</p>
]]></description><guid isPermaLink="false">95827</guid><pubDate>Fri, 01 Jan 2021 21:07:17 +0000</pubDate></item><item><title>Use enchantments in anvil on tools build from custom ore</title><link>https://forums.minecraftforge.net/topic/160373-use-enchantments-in-anvil-on-tools-build-from-custom-ore/</link><description><![CDATA[<p>I created a mod in which there are four new ores better than diamond. They allows to create sword, pickaxe, axe, shovel and hoe.</p><p>The tools works.</p><p></p><p>When I wanted enchant the pickaxe, I succeeded with the enchantment table to put unbreaking III. Next, I enchanted a book with fortune III. When I put in a anvil my enchanted pickaxe with the fortune III book, the red cross displayed on the arrow. I have the same issue to merge two enchanted pickaxes in a anvil.</p><p></p><p></p><p>How could I programme the enchantments for the new tools ?</p><p></p><p>I can send you many code parts.</p>]]></description><guid isPermaLink="false">160373</guid><pubDate>Tue, 30 Jun 2026 15:59:22 +0000</pubDate></item><item><title>[1.20.1] Detect Block Break by non-player entity</title><link>https://forums.minecraftforge.net/topic/160301-1201-detect-block-break-by-non-player-entity/</link><description><![CDATA[<p><span style='font-family: "Helvetica", "Arial", sans-serif;'>I have some blocks in my mod which detect when a player breaks them using the BreakEvent. In survival mode, the block drops an item and is immediately replaced by the same block, making an infinite farm basically. In creative mode, you can permanently destroy/place the block as normal. That seems to work well for players, but say if a modded block (like the Create mod drill) breaks them, then it seems to simply just destroy the block, without triggering the event. How could I make is such that a non-player like the drill can replicate that same behavior as a player in survival?</span></p><p></p><p><span style='font-family: "Helvetica", "Arial", sans-serif;'>Based upon my own research into Create's source code (plus my own testing), the drill does not seem to trigger a BreakEvent. Though I'm surprised the event just doesn't trigger on its own anyways (though I am still learning about events generally so I am probably missing something).</span></p><p></p><pre spellcheck="" class="ipsCode language-java" data-language="Java"><code>public static class ForgeEvents {          
	@SubscribeEvent         
	public static void onBreak(BlockEvent.BreakEvent event) {              
		BlockEntity blockEntity = event.getLevel().getBlockEntity(event.getPos());             
		boolean found = false;              
		if (blockEntity instanceof OreVeinEntity) {                 
			//creative mode only can destroy the blocks                 
			if (!event.getPlayer().isCreative()) { 
//do stuff</code></pre>]]></description><guid isPermaLink="false">160301</guid><pubDate>Wed, 03 Jun 2026 03:35:11 +0000</pubDate></item><item><title>[1.8] Any way to make vanilla dirt a falling block?</title><link>https://forums.minecraftforge.net/topic/27632-18-any-way-to-make-vanilla-dirt-a-falling-block/</link><description><![CDATA[<p>Sadly, I believe this will require ASM, but I was wondering if I could use at worst reflection, which I am comfortable with, or some other method to replace the vanilla dirt block with my own? There is no way I could use events, right?</p>]]></description><guid isPermaLink="false">27632</guid><pubDate>Sat, 14 Feb 2015 23:06:45 +0000</pubDate></item><item><title>Checking if a mobs path is reachable.</title><link>https://forums.minecraftforge.net/topic/159937-checking-if-a-mobs-path-is-reachable/</link><description><![CDATA[<p>So im creating a fabric mod in 1.21.11. (I know not forge). And Im working on a mixin for a wolf overhaul mod. Im trying to do some stuff with the pathfinding. And one of the requirements is that I need to be able to pick a point and determine whether or not that point is a reachable path. The constraints are I need to check if the path is reachable with or without ignoring obstacles. I reset my desired maluses. And ive tried several attempts at path checking. The first attempt was trying to create a path and just using .canReach() The issue is that this method is completely misleading. I looked at the internals and it doesnt actually tell you if the path is reachable or not it tells you if the Mob already reached that path endpoint.... So that didnt really work, my next attempt was simpler but it was to check if the created paths end point matches the target end point. Unfortunately this created false positives where the path had 1 node which was the target. So I tried filtering the length and still it doesnt really work. So I wasnt able to come up with a working solution towards path checking unfortunately. Any help is appreciated.</p>]]></description><guid isPermaLink="false">159937</guid><pubDate>Wed, 01 Apr 2026 16:50:54 +0000</pubDate></item><item><title>[1.20.1] Weird problem with tiers</title><link>https://forums.minecraftforge.net/topic/159909-1201-weird-problem-with-tiers/</link><description><![CDATA[<p>My mod has multiple materials at stone, iron and diamond level.</p><p>1 of my materials is also better than diamond/netherite.</p><p></p><p>Now I have the weird problem that the iron pickaxe isn't able to mine any blocks that require an iron pickaxe (<em>like diamond ore, gold ore, etc.</em>), but my own pickaxes at iron level can mine such blocks.</p><p>Additionally I have the same problem with the diamond and netherite pickaxes which can't mine any blocks which require a diamond pickaxe (<em>like obsidian and ancient debris</em>), my own pickaxes at diamond level or better can still mine those blocks.</p><p></p><p>As an additional information, I never used the tier sorting registry because I don't understand it.</p><p>So I don't know if this is now a code problem or a datapack problem.</p><p>I hope you may help me with my weird problem...</p>]]></description><guid isPermaLink="false">159909</guid><pubDate>Wed, 18 Mar 2026 18:06:01 +0000</pubDate></item><item><title>Unexpected out of bounds error for armpose</title><link>https://forums.minecraftforge.net/topic/159896-unexpected-out-of-bounds-error-for-armpose/</link><description><![CDATA[<figure data-og-url="https://pastebin.com/1Z8Gxudv" data-og-description="Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time." data-og-title="crashlog - Pastebin.com" data-og-site_name="Pastebin" data-og-favicon_url="https://pastebin.com/favicon.ico" data-og-user_text="https://pastebin.com/1Z8Gxudv" class="ipsEmbedded_og ipsEmbedded"><div class="ipsEmbedded_og__site-name"><img class="ipsEmbedded_og__favicon" src="https://pastebin.com/favicon.ico" alt=""><h5>Pastebin</h5></div><figcaption><h3 class="ipsEmbedded_og__title">crashlog - Pastebin.com</h3><div class="ipsEmbedded_og__description">Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.</div></figcaption></figure><p>I have an item that i want to customise the arm pose while it is being held so i have setup initializeClient with IClientItemExtensions and have managed to apply a custom renderer to it doing that, however when i try to apply a custom arm pose it causes the out of bounds error above</p><p></p><figure data-og-url="https://pastebin.com/p3hDqbjT" data-og-description="Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time." data-og-title="code snippet - Pastebin.com" data-og-site_name="Pastebin" data-og-favicon_url="https://pastebin.com/favicon.ico" data-og-user_text="https://pastebin.com/p3hDqbjT" class="ipsEmbedded_og ipsEmbedded"><div class="ipsEmbedded_og__site-name"><img class="ipsEmbedded_og__favicon" src="https://pastebin.com/favicon.ico" alt=""><h5>Pastebin</h5></div><figcaption><h3 class="ipsEmbedded_og__title">code snippet - Pastebin.com</h3><div class="ipsEmbedded_og__description">Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.</div></figcaption></figure><figure data-og-url="https://pastebin.com/q3qJKB7F" data-og-description="Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time." data-og-title="held entity pose - Pastebin.com" data-og-site_name="Pastebin" data-og-favicon_url="https://pastebin.com/favicon.ico" data-og-user_text="https://pastebin.com/q3qJKB7F" class="ipsEmbedded_og ipsEmbedded"><div class="ipsEmbedded_og__site-name"><img class="ipsEmbedded_og__favicon" src="https://pastebin.com/favicon.ico" alt=""><h5>Pastebin</h5></div><figcaption><h3 class="ipsEmbedded_og__title">held entity pose - Pastebin.com</h3><div class="ipsEmbedded_og__description">Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.</div></figcaption></figure><p>this is the code snippet for initializeClient and HELD_ENTITY_POSE</p><p></p><p>everything i have seen says to create the custom pose this way but it doesnt work for me so clearly i am missing something obvious, thankyou in advance for your time</p>]]></description><guid isPermaLink="false">159896</guid><pubDate>Fri, 13 Mar 2026 19:20:25 +0000</pubDate></item><item><title>Making Minecraft Tnt Mods Look Cleaner With Big Explosions</title><link>https://forums.minecraftforge.net/topic/159875-making-minecraft-tnt-mods-look-cleaner-with-big-explosions/</link><description><![CDATA[<p>How do I make large tnt's look cleaner, I started making a Tnt mod recently and have been able to add my own explosions but I don't know how to make it look cleaner, here's a screenshot of the explosion after I explode my 50 times Tnt: <a rel="external nofollow" href="https://i.postimg.cc/Bt9cKQt9/Tnt-times-50-explosion.png">Tnt times 50 explosion</a></p>]]></description><guid isPermaLink="false">159875</guid><pubDate>Thu, 05 Mar 2026 10:32:33 +0000</pubDate></item><item><title>AddPackFindersEvent 1.20.1 Help</title><link>https://forums.minecraftforge.net/topic/159864-addpackfindersevent-1201-help/</link><description><![CDATA[<p>My mod has been having issues with loading my datapacks in the correct order, and not allowing my custom recipes and loot_tables to load correctly because of it. The default Minecraft recipes have been overriding mine.<br><br>After requesting help in some discord servers, I was told I need to use the AddPackFindersEvent, and I cannot find any documentation on this anywhere. <br><br>If anyone can help me with this in any way, that would be amazing. <br><br>Thank you in advance.</p>]]></description><guid isPermaLink="false">159864</guid><pubDate>Tue, 24 Feb 2026 03:35:17 +0000</pubDate></item><item><title>The texture for the mod item created in 1.21.11 is not being applied.</title><link>https://forums.minecraftforge.net/topic/159789-the-texture-for-the-mod-item-created-in-12111-is-not-being-applied/</link><description><![CDATA[<p>I apologize in advance if the translation sounds unnatural, as I'm not very good at English.</p><p>As a beginner, I managed to run runClient in my own MOD and display items in-game by watching videos posted on YouTube. However, the item images did not appear.</p><p>Since there's no one in Japan who can help me, I humbly request your assistance.</p><p>I thought checking the directories and image names within IDEA might solve it, but...</p><p>I committed the src of my mod to Git. If anyone has time to take a look, I'd be very grateful.</p><p></p><p><a rel="external" href="https://github.com/ZousanElephant/noob-mod">https://github.com/ZousanElephant/noob-mod</a></p>]]></description><guid isPermaLink="false">159789</guid><pubDate>Thu, 22 Jan 2026 15:03:26 +0000</pubDate></item><item><title>Caused by: java.lang.IllegalArgumentException: Unable to find model file:</title><link>https://forums.minecraftforge.net/topic/159762-caused-by-javalangillegalargumentexception-unable-to-find-model-file/</link><description><![CDATA[<p>Yes, the same problem is exactly the same, I did everything right, I was tired of using chatgpt, I was already tired of checking all the options, the paths definitely don't match, and the code itself just doesn't see this file, I tried to check the logs, and everything is called and working, but it's not visible. Also version 1.21.5.<br><br>Here is a piece of code:<br>@Override
public ResourceLocation getModelResource(GeoRenderState state) {
    return ResourceLocation.fromNamespaceAndPath(
            LiskaMod.MODID,
            "geo/liska"
    );
}<br>I tried different ways of writing paths, but more than one did not help.<br>Here is my path to the file that cannot be found: "src\main\resources\assets\liskamod\geo\liska.geo.json"<br>And here's the damn mistake itself: Caused by: java.lang.IllegalArgumentException: Unable to find model file: liskamod:geo/liska <br><br>If anyone knows what the error is, please tell me! I will be very grateful.<br><br><br><br></p>]]></description><guid isPermaLink="false">159762</guid><pubDate>Mon, 12 Jan 2026 23:28:41 +0000</pubDate></item><item><title>Tracking player movement for model and animations change</title><link>https://forums.minecraftforge.net/topic/159757-tracking-player-movement-for-model-and-animations-change/</link><description><![CDATA[<p>In attempts to get Woodwalkers (parent mod of Remorph) working with GeckoLib (used for entity model and animations) in order to not t-pose around on other players' views, we're going through the <em>PlayerEntityRendererMixin</em> file of Woodwalkers and trying to correct how it tracks player motion into a way that is not so client-sided</p><p><br>Currently it uses this:</p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>
shape.walkAnimation).setPos(player.walkAnimation.position());
            //#else
            //$$ shape.animationSpeedOld = player.animationSpeedOld;
            //$$ shape.animationSpeed = player.animationSpeed;
            //$$ shape.animationPosition = player.animationPosition;
            //#endif
            shape.swinging = player.swinging;
            shape.swingTime = player.swingTime;
            shape.oAttackAnim = player.oAttackAnim;
            shape.attackAnim = player.attackAnim;
            shape.yBodyRot = player.yBodyRot;
            shape.yBodyRotO = player.yBodyRotO;
            shape.yHeadRot = player.yHeadRot;
            shape.yHeadRotO = player.yHeadRotO;
            shape.tickCount = player.tickCount;
            shape.swingingArm = player.swingingArm;
            ((LivingEntityAccessor) shape).setSwimAmount(((LivingEntityAccessor) player).getSwimAmount());
            ((LivingEntityAccessor) shape).setSwimAmountO(((LivingEntityAccessor) player).getSwimAmountO());
            shape.setOnGround(CEntity.isOnGround(player));
            shape.setDeltaMovement(player.getDeltaMovement());</code></pre><p>Someone from GeckoLib's server has said that it's an issue with Woodwalkers using DeltaMovement, as is the last line, saying that <em>getDeltaMovement</em> is usually set to 0 for the player, and that this is why it's not translating into the new model's movement/animations correctly when in multiplayer</p><p></p><p>Does anyone know what we would have to change this tracking to in order to make it work?</p>]]></description><guid isPermaLink="false">159757</guid><pubDate>Sun, 11 Jan 2026 22:17:51 +0000</pubDate></item><item><title>[SOLVED] Error when trying to add dependency</title><link>https://forums.minecraftforge.net/topic/159751-solved-error-when-trying-to-add-dependency/</link><description><![CDATA[<p>I am attempting to make a mod that serves as an expansion to the mod Basic Weapons by Khazoda for a (currently) personal modpack. I want to add a custom tier of the weapons that the mod adds, so I thought the simplest solution would be to make a mod that depends on BW to work (I tried KubeJS and that was a no go given other mods that interact with the weapons). Depending on BW would also let me use the methods so I don't have to recreate the behavior of certain weapons. To start, I followed KaupenJoe's 1.20.1 modding setup tutorial and the simple item tutorial. Then I followed the Modrinth Maven tutorial to add BW as a dependency to my mod. I swear on my soul that after doing this, ONCE I was able to do the gradle runClient, and the game loaded up with no errors. However, now every time I try to do this again, I get this error showing in the game client:</p><p>Basic Weapons (basicweapons) has failed to load correctly</p><p>org.spongepowered.asm.mixin.transformer.throwables.MixinTransformerError: An unexpected critical error was encountered</p><p>Here is the latest crash .txt and the latest.log:</p><p><a rel="external nofollow" href="https://pastebin.com/MpdMwwj6">pastebin.com/MpdMwwj6</a></p><p><a rel="external nofollow" href="https://pastebin.com/RMXM3g5p">pastebin.com/RMXM3g5p</a></p><p>I think it has to do with their use of the spongepowered mixin thing in their build.gradle, but it may also be related to the fact I am using parchment mapping (just what the tutorial said to do, feel free to say if using that is bad practice) and BW is using official mappings. Here is also my git page for my mod in its current state, along with the page for Khazodas mod (the branch that I am currently dealing with via Modrinth maven):</p><p><a rel="external" href="https://github.com/McNasty102/Forge-Mod-Test/tree/mod-test">github.com/McNasty102/Forge-Mod-Test/tree/mod-test</a></p><p><a rel="external" href="https://github.com/Khazoda/basic-weapons/tree/1.20.1-forge">github.com/Khazoda/basic-weapons/tree/1.20.1-forge</a></p>]]></description><guid isPermaLink="false">159751</guid><pubDate>Fri, 09 Jan 2026 16:53:53 +0000</pubDate></item><item><title>How can I make custom statistics?</title><link>https://forums.minecraftforge.net/topic/152695-how-can-i-make-custom-statistics/</link><description><![CDATA[<p>
	I am attempting to create a mod that adds custom <a href="https://minecraft.fandom.com/wiki/Statistics" rel="external nofollow">statistics</a> to Minecraft.
</p>

<p>
	I've had some help from LexManos on the Discord server, but posting a lot of what I posted in the <strong>#mod-dev-support-1.20 channel</strong> here to have a more permanent spot for discussion.
</p>

<p>
	 
</p>

<p>
	---
</p>

<p>
	 
</p>

<p>
	Minecraft creates their stats like this:
</p>

<div class="ipsSpoiler" data-ipsspoiler="">
	<div class="ipsSpoiler_header">
		<span>Spoiler</span>
	</div>

	<div class="ipsSpoiler_contents">
		<pre class="ipsCode prettyprint lang-c prettyprinted"><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">Stats</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
   </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> final </span><span class="typ">StatType</span><span class="pun">&lt;</span><span class="typ">Block</span><span class="pun">&gt;</span><span class="pln"> BLOCK_MINED </span><span class="pun">=</span><span class="pln"> makeRegistryStatType</span><span class="pun">(</span><span class="str">"mined"</span><span class="pun">,</span><span class="pln"> </span><span class="typ">BuiltInRegistries</span><span class="pun">.</span><span class="pln">BLOCK</span><span class="pun">);</span><span class="pln">
   </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> final </span><span class="typ">StatType</span><span class="pun">&lt;</span><span class="typ">Item</span><span class="pun">&gt;</span><span class="pln"> ITEM_CRAFTED </span><span class="pun">=</span><span class="pln"> makeRegistryStatType</span><span class="pun">(</span><span class="str">"crafted"</span><span class="pun">,</span><span class="pln"> </span><span class="typ">BuiltInRegistries</span><span class="pun">.</span><span class="pln">ITEM</span><span class="pun">);</span><span class="pln">
   </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> final </span><span class="typ">StatType</span><span class="pun">&lt;</span><span class="typ">EntityType</span><span class="pun">&lt;?&gt;&gt;</span><span class="pln"> ENTITY_KILLED </span><span class="pun">=</span><span class="pln"> makeRegistryStatType</span><span class="pun">(</span><span class="str">"killed"</span><span class="pun">,</span><span class="pln"> </span><span class="typ">BuiltInRegistries</span><span class="pun">.</span><span class="pln">ENTITY_TYPE</span><span class="pun">);</span><span class="pln">
   </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> final </span><span class="typ">StatType</span><span class="pun">&lt;</span><span class="typ">ResourceLocation</span><span class="pun">&gt;</span><span class="pln"> CUSTOM </span><span class="pun">=</span><span class="pln"> makeRegistryStatType</span><span class="pun">(</span><span class="str">"custom"</span><span class="pun">,</span><span class="pln"> </span><span class="typ">BuiltInRegistries</span><span class="pun">.</span><span class="pln">CUSTOM_STAT</span><span class="pun">);</span><span class="pln">
   </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> final </span><span class="typ">ResourceLocation</span><span class="pln"> LEAVE_GAME </span><span class="pun">=</span><span class="pln"> makeCustomStat</span><span class="pun">(</span><span class="str">"leave_game"</span><span class="pun">,</span><span class="pln"> </span><span class="typ">StatFormatter</span><span class="pun">.</span><span class="pln">DEFAULT</span><span class="pun">);</span><span class="pln">
   </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> final </span><span class="typ">ResourceLocation</span><span class="pln"> PLAY_TIME </span><span class="pun">=</span><span class="pln"> makeCustomStat</span><span class="pun">(</span><span class="str">"play_time"</span><span class="pun">,</span><span class="pln"> </span><span class="typ">StatFormatter</span><span class="pun">.</span><span class="pln">TIME</span><span class="pun">);</span><span class="pln">
  
   </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> </span><span class="typ">ResourceLocation</span><span class="pln"> makeCustomStat</span><span class="pun">(</span><span class="typ">String</span><span class="pln"> p_13008_</span><span class="pun">,</span><span class="pln"> </span><span class="typ">StatFormatter</span><span class="pln"> p_13009_</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
      </span><span class="typ">ResourceLocation</span><span class="pln"> resourcelocation </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">ResourceLocation</span><span class="pun">(</span><span class="pln">p_13008_</span><span class="pun">);</span><span class="pln">
      </span><span class="typ">Registry</span><span class="pun">.</span><span class="kwd">register</span><span class="pun">(</span><span class="typ">BuiltInRegistries</span><span class="pun">.</span><span class="pln">CUSTOM_STAT</span><span class="pun">,</span><span class="pln"> p_13008_</span><span class="pun">,</span><span class="pln"> resourcelocation</span><span class="pun">);</span><span class="pln">
      CUSTOM</span><span class="pun">.</span><span class="pln">get</span><span class="pun">(</span><span class="pln">resourcelocation</span><span class="pun">,</span><span class="pln"> p_13009_</span><span class="pun">);</span><span class="pln">
      </span><span class="kwd">return</span><span class="pln"> resourcelocation</span><span class="pun">;</span><span class="pln">
   </span><span class="pun">}</span><span class="pln">

   </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> </span><span class="pun">&lt;</span><span class="pln">T</span><span class="pun">&gt;</span><span class="pln"> </span><span class="typ">StatType</span><span class="pun">&lt;</span><span class="pln">T</span><span class="pun">&gt;</span><span class="pln"> makeRegistryStatType</span><span class="pun">(</span><span class="typ">String</span><span class="pln"> p_13011_</span><span class="pun">,</span><span class="pln"> </span><span class="typ">Registry</span><span class="pun">&lt;</span><span class="pln">T</span><span class="pun">&gt;</span><span class="pln"> p_13012_</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
      </span><span class="typ">Component</span><span class="pln"> component </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Component</span><span class="pun">.</span><span class="pln">translatable</span><span class="pun">(</span><span class="str">"stat_type.minecraft."</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> p_13011_</span><span class="pun">);</span><span class="pln">
      </span><span class="kwd">return</span><span class="pln"> </span><span class="typ">Registry</span><span class="pun">.</span><span class="kwd">register</span><span class="pun">(</span><span class="typ">BuiltInRegistries</span><span class="pun">.</span><span class="pln">STAT_TYPE</span><span class="pun">,</span><span class="pln"> p_13011_</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">StatType</span><span class="pun">&lt;&gt;(</span><span class="pln">p_13012_</span><span class="pun">,</span><span class="pln"> component</span><span class="pun">));</span><span class="pln">
   </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></pre>
	</div>
</div>

<p>
	and some of the registries in the code above are located in <strong>BuiltInRegistries.java </strong>like this:
</p>

<div class="ipsSpoiler" data-ipsspoiler="">
	<div class="ipsSpoiler_header">
		<span>Spoiler</span>
	</div>

	<div class="ipsSpoiler_contents">
		<pre class="ipsCode prettyprint lang-c prettyprinted"><span class="com">/**
 * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#STAT_TYPES} instead.
 */</span><span class="pln">
</span><span class="lit">@Deprecated</span><span class="pln">
</span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> final </span><span class="typ">Registry</span><span class="pun">&lt;</span><span class="typ">StatType</span><span class="pun">&lt;?&gt;&gt;</span><span class="pln"> STAT_TYPE </span><span class="pun">=</span><span class="pln"> forge</span><span class="pun">(</span><span class="typ">Registries</span><span class="pun">.</span><span class="pln">STAT_TYPE</span><span class="pun">,</span><span class="pln"> </span><span class="pun">(</span><span class="pln">p_259967_</span><span class="pun">)</span><span class="pln"> </span><span class="pun">-&gt;</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="kwd">return</span><span class="pln"> </span><span class="typ">Stats</span><span class="pun">.</span><span class="pln">ITEM_USED</span><span class="pun">;</span><span class="pln">
</span><span class="pun">});</span><span class="pln">

</span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> final </span><span class="typ">Registry</span><span class="pun">&lt;</span><span class="typ">ResourceLocation</span><span class="pun">&gt;</span><span class="pln"> CUSTOM_STAT </span><span class="pun">=</span><span class="pln"> registerSimple</span><span class="pun">(</span><span class="typ">Registries</span><span class="pun">.</span><span class="pln">CUSTOM_STAT</span><span class="pun">,</span><span class="pln"> </span><span class="pun">(</span><span class="pln">p_259833_</span><span class="pun">)</span><span class="pln"> </span><span class="pun">-&gt;</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="kwd">return</span><span class="pln"> </span><span class="typ">Stats</span><span class="pun">.</span><span class="pln">JUMP</span><span class="pun">;</span><span class="pln">
</span><span class="pun">});</span></pre>
	</div>
</div>

<p>
	and the <strong>ForgeRegistries#STAT_TYPES </strong>looks like this:
</p>

<div class="ipsSpoiler" data-ipsspoiler="">
	<div class="ipsSpoiler_header">
		<span>Spoiler</span>
	</div>

	<div class="ipsSpoiler_contents">
		<pre class="ipsCode prettyprint lang-c prettyprinted"><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> final </span><span class="typ">IForgeRegistry</span><span class="pun">&lt;</span><span class="typ">StatType</span><span class="pun">&lt;?&gt;&gt;</span><span class="pln"> STAT_TYPES </span><span class="pun">=</span><span class="pln"> active</span><span class="pun">(</span><span class="typ">Keys</span><span class="pun">.</span><span class="pln">STAT_TYPES</span><span class="pun">);</span></pre>
	</div>
</div>

<p>
	So, attempting to follow that and the forge documentation on <a href="https://docs.minecraftforge.net/en/latest/concepts/registries/" rel="external">registries</a> I arrived at this:
</p>

<div class="ipsSpoiler" data-ipsspoiler="">
	<div class="ipsSpoiler_header">
		<span>Spoiler</span>
	</div>

	<div class="ipsSpoiler_contents">
		<pre class="ipsCode prettyprint lang-c prettyprinted"><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">SampleModStatisticsRegistry</span><span class="pln"> </span><span class="pun">{</span><span class="pln">

    </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> final </span><span class="typ">DeferredRegister</span><span class="pun">&lt;</span><span class="typ">StatType</span><span class="pun">&lt;?&gt;&gt;</span><span class="pln"> STATISTICS </span><span class="pun">=</span><span class="pln"> </span><span class="typ">DeferredRegister</span><span class="pun">.</span><span class="pln">create</span><span class="pun">(</span><span class="typ">ForgeRegistries</span><span class="pun">.</span><span class="pln">STAT_TYPES</span><span class="pun">,</span><span class="pln"> </span><span class="typ">SampleMod</span><span class="pun">.</span><span class="pln">MODID</span><span class="pun">);</span><span class="pln">

    </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> final </span><span class="typ">RegistryObject</span><span class="pun">&lt;</span><span class="typ">StatType</span><span class="pun">&lt;?&gt;&gt;</span><span class="pln"> FIREWORK_BOOSTS_USED </span><span class="pun">=</span><span class="pln"> STATISTICS</span><span class="pun">.</span><span class="kwd">register</span><span class="pun">(</span><span class="str">"firework_boosts_used"</span><span class="pun">,</span><span class="pln">
            </span><span class="pun">()</span><span class="pln"> </span><span class="pun">-&gt;</span><span class="pln"> makeRegistryStatType</span><span class="pun">(</span><span class="str">"firework_boosts_used"</span><span class="pun">,</span><span class="pln"> </span><span class="typ">BuiltInRegistries</span><span class="pun">.</span><span class="pln">CUSTOM_STAT</span><span class="pun">));</span><span class="pln">

    </span><span class="com">// code stolen from Minecraft's Stats file</span><span class="pln">
    </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> </span><span class="pun">&lt;</span><span class="pln">T</span><span class="pun">&gt;</span><span class="pln"> </span><span class="typ">StatType</span><span class="pun">&lt;</span><span class="pln">T</span><span class="pun">&gt;</span><span class="pln"> makeRegistryStatType</span><span class="pun">(</span><span class="typ">String</span><span class="pln"> p_13011_</span><span class="pun">,</span><span class="pln"> </span><span class="typ">Registry</span><span class="pun">&lt;</span><span class="pln">T</span><span class="pun">&gt;</span><span class="pln"> p_13012_</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        </span><span class="typ">Component</span><span class="pln"> component </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Component</span><span class="pun">.</span><span class="pln">translatable</span><span class="pun">(</span><span class="str">"stat_type.minecraft."</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> p_13011_</span><span class="pun">);</span><span class="pln">
        </span><span class="kwd">return</span><span class="pln"> </span><span class="typ">Registry</span><span class="pun">.</span><span class="kwd">register</span><span class="pun">(</span><span class="typ">BuiltInRegistries</span><span class="pun">.</span><span class="pln">STAT_TYPE</span><span class="pun">,</span><span class="pln"> p_13011_</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">StatType</span><span class="pun">&lt;&gt;(</span><span class="pln">p_13012_</span><span class="pun">,</span><span class="pln"> component</span><span class="pun">));</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></pre>
	</div>
</div>

<p>
	Clearly, registering a stat twice in a row is the wrong way to do it, but the <strong>makeRegistryStatType</strong> function was used as it does give the correct return type for the code I had come up with so far.
</p>

<p>
	 
</p>

<p>
	---
</p>

<p>
	 
</p>

<p>
	At this point the game crashes upon trying to use <strong>Player#awardStat</strong>, because of a NPE that occurs in <strong>Stat#locationToKey</strong>.
</p>

<div class="ipsSpoiler" data-ipsspoiler="">
	<div class="ipsSpoiler_header">
		<span>Spoiler</span>
	</div>

	<div class="ipsSpoiler_contents">
		<pre class="ipsCode">java.lang.NullPointerException: Cannot invoke "net.minecraft.resources.ResourceLocation.toString()" because "p_12866_" is null
	at net.minecraft.stats.Stat.locationToKey(Stat.java:26) ~[forge-1.20.2-48.1.0_mapped_official_1.20.2-recomp.jar%23199!/:?] {re:classloading}
	at net.minecraft.stats.Stat.buildName(Stat.java:22) ~[forge-1.20.2-48.1.0_mapped_official_1.20.2-recomp.jar%23199!/:?] {re:classloading}
	at net.minecraft.stats.Stat.&lt;init&gt;(Stat.java:15) ~[forge-1.20.2-48.1.0_mapped_official_1.20.2-recomp.jar%23199!/:?] {re:classloading}
	at net.minecraft.stats.StatType.lambda$get$0(StatType.java:25) ~[forge-1.20.2-48.1.0_mapped_official_1.20.2-recomp.jar%23199!/:?] {re:classloading}
	at java.util.Map.computeIfAbsent(Map.java:1054) ~[?:?] {re:mixin}
	at net.minecraft.stats.StatType.get(StatType.java:24) ~[forge-1.20.2-48.1.0_mapped_official_1.20.2-recomp.jar%23199!/:?] {re:classloading}
	at net.minecraft.stats.StatType.get(StatType.java:38) ~[forge-1.20.2-48.1.0_mapped_official_1.20.2-recomp.jar%23199!/:?] {re:classloading}
	at net.minecraft.world.entity.player.Player.awardStat(Player.java:1364) ~[forge-1.20.2-48.1.0_mapped_official_1.20.2-recomp.jar%23199!/:?] {re:classloading,pl:accesstransformer:B}</pre>
	</div>
</div>

<p>
	Which happens in the 2nd <strong>Stat#locationToKey</strong> in the <strong>Stat#buildName</strong> function.
</p>

<div class="ipsSpoiler" data-ipsspoiler="">
	<div class="ipsSpoiler_header">
		<span>Spoiler</span>
	</div>

	<div class="ipsSpoiler_contents">
		<pre class="ipsCode prettyprint lang-c prettyprinted"><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> </span><span class="pun">&lt;</span><span class="pln">T</span><span class="pun">&gt;</span><span class="pln"> </span><span class="typ">String</span><span class="pln"> buildName</span><span class="pun">(</span><span class="typ">StatType</span><span class="pun">&lt;</span><span class="pln">T</span><span class="pun">&gt;</span><span class="pln"> p_12863_</span><span class="pun">,</span><span class="pln"> T p_12864_</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="kwd">return</span><span class="pln"> locationToKey</span><span class="pun">(</span><span class="typ">BuiltInRegistries</span><span class="pun">.</span><span class="pln">STAT_TYPE</span><span class="pun">.</span><span class="pln">getKey</span><span class="pun">(</span><span class="pln">p_12863_</span><span class="pun">))</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">":"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> locationToKey</span><span class="pun">(</span><span class="pln">p_12863_</span><span class="pun">.</span><span class="pln">getRegistry</span><span class="pun">().</span><span class="pln">getKey</span><span class="pun">(</span><span class="pln">p_12864_</span><span class="pun">));</span><span class="pln">
</span><span class="pun">}</span></pre>
	</div>
</div>

<p>
	The <strong>.getRegistry</strong> returns the <strong>this.registry</strong> class variable with a value of <strong>{MappedRegistry@#####} "Registry[ResourceKey[minecraft:root / minecraft:custom_stat] (Stable)]"</strong>
</p>

<p>
	The value passed into <strong>.getKey</strong> is "samplemod:fireworks_boosts_used" but the reference found is null.
</p>

<p>
	So Lex's conclusion was that "<em>[I'm] passing in null because the registry doesnt have an entry for your custom stat instance. So.. register your custom stat instance in that registry."</em>
</p>

<p>
	 
</p>

<p>
	<em>---</em>
</p>

<p>
	 
</p>

<p>
	So I suppose at this point my questions are
</p>

<p>
	1. How can I create a supplier that returns a <strong>Supplier&lt;? extends StatType&lt;?&gt;&gt;</strong> to replace the <strong>() -&gt; makeRegistryStatType("firework_boosts_used", BuiltInRegistries.CUSTOM_STAT) </strong>line of code.
</p>

<p>
	2. Is my registry entry <strong>public static final RegistryObject&lt;StatType&lt;?&gt;&gt; FIREWORK_BOOSTS_USED </strong>the correct type?
</p>

<p>
	3. Do I need to do anything additional, like create my own <strong>StatType&lt;&gt; </strong>or my own <strong>Stat&lt;&gt;</strong> ?
</p>
]]></description><guid isPermaLink="false">152695</guid><pubDate>Sat, 05 Oct 2024 21:16:38 +0000</pubDate></item><item><title>Best Practices for Structuring Larger Forge Mods (Looking for Feedback)</title><link>https://forums.minecraftforge.net/topic/159725-best-practices-for-structuring-larger-forge-mods-looking-for-feedback/</link><description><![CDATA[<p>Hi everyone,</p><p>My name is <strong>Myroslav Mokhammad Abdeljawwad</strong>, and I’ve been working on a Forge mod recently while trying to improve how I structure larger projects for long-term maintainability. I wanted to ask for some feedback from more experienced modders and also share a few things I’ve learned so far.</p><p>As projects grow, I’ve noticed that structure becomes more important than any individual feature. Small mods can get away with everything living in one package, but once you introduce registries, data generation, events, client/server separation, and configuration handling, things get messy very quickly.</p><p>One of the most helpful resources I’ve been using is the official Forge documentation, especially the sections related to mod lifecycle and registration:</p><p><a rel="external" href="https://docs.minecraftforge.net/en/latest/">https://docs.minecraftforge.net/en/latest/</a><br><a rel="external" href="https://docs.minecraftforge.net/en/latest/concepts/lifecycle/">https://docs.minecraftforge.net/en/latest/concepts/lifecycle/</a></p><p>These helped me better understand when certain logic should run and how Forge expects mods to be structured internally.</p><p>I’ve also been looking at how larger open-source mods organize their code. Some good examples I found useful for reference are:</p><p><a rel="external" href="https://github.com/MinecraftForge/MinecraftForge">https://github.com/MinecraftForge/MinecraftForge</a><br><a rel="external" href="https://github.com/VazkiiMods/Botania">https://github.com/VazkiiMods/Botania</a><br><a rel="external" href="https://github.com/TerraformersMC">https://github.com/TerraformersMC</a></p><p>What stood out to me is how clearly these projects separate responsibilities between core logic, client-side rendering, data generation, and utilities.</p><p>One thing I’m still unsure about is how far abstraction should go. On one hand, abstracting logic makes the code cleaner and easier to reuse. On the other hand, too much abstraction can make debugging more difficult, especially when working with Forge’s event-based system.</p><p>I’ve also been spending time learning about data generation and how it should be kept separate from runtime logic. The documentation and examples around this have been helpful, especially for recipes, loot tables, and block states:</p><p><a rel="external nofollow" href="https://mcforge.readthedocs.io/en/latest/datagen/intro/">https://mcforge.readthedocs.io/en/latest/datagen/intro/</a><br><a rel="external nofollow" href="https://minecraft.fandom.com/wiki/Data_generator">https://minecraft.fandom.com/wiki/Data_generator</a></p><p>Performance is another area I’m paying attention to. I’ve seen recommendations to keep event handlers lightweight and to strictly separate client-only logic to avoid server-side issues, especially in larger modpacks.</p><p>I’d really appreciate hearing how others approach:</p><ul><li><p>Structuring medium to large Forge mods</p></li><li><p>Keeping code readable as projects grow</p></li><li><p>Managing client/server separation</p></li><li><p>Avoiding common architectural mistakes</p></li></ul><p>Any advice or examples from your own experience would be great. Thanks in advance!</p>]]></description><guid isPermaLink="false">159725</guid><pubDate>Tue, 30 Dec 2025 23:57:32 +0000</pubDate></item></channel></rss>
