Skip to content

Instantly share code, notes, and snippets.

@williewillus
williewillus / primer.md
Last active April 22, 2024 15:29
1.13/1.14 update primer

This primer is licensed under CC0, do whatever you want.

BUT do note that this can be updated, so leave a link here so readers can see the updated information themselves.

1.13 and 1.14 are lumped together in this doc, you're on your own if you just want to go to 1.13 and not 1.14, for some reason.

1.15 stuff: https://gist.github.com/williewillus/30d7e3f775fe93c503bddf054ef3f93e

Things in Advance

  • ResourceLocation now throw on non-snake-case names instead of silently lowercasing for you, so you probably should go and change all those string constants now. More precisely, domains must only contain alphanumeric lowercase, underscore (_), dash (-), or dot (.). Paths have the same restrictions, but can also contain forward slashes (/).
@Choonster
Choonster / ModelLoadingProcess.md
Last active January 15, 2021 11:20
A description of the model loading process in Minecraft Forge 1.9-1.12.1

In this document, I use strings in the format "foo:bar" to represent ResourceLocations with domain foo and path bar. I also use [square brackets] for placeholders.

The Model Loading Process

Blocks

On startup and whenever the resources are reloaded (in ModelLoader#setupModelRegistry), Minecraft iterates through every registered Block (in ModelLoader#loadBlocks) and asks its custom IStateMapper (or DefaultStateMapper if none has been registered) to create a mapping between every valid IBlockState of the Block and the ModelResourceLocation for that state (with the domain and path pointing to a blockstates file and the variant to a variant within that file). It then attempts to load these models.

DefaultStateMapper looks for the blockstates file with the Block's registry name (i.e. assets/[modid]/blockstates/[name].json) and serialises each property and value of the IBlockState to create the variant name that the model is loaded from (e.g. "enabled=true,type=foobar"

@stevewoolcock
stevewoolcock / TurnSystem.cs
Created July 13, 2014 06:01
A simple roguelike turn system, very similar to that of Angband.
// A Roguelike turn system
// http://blog.deadreckoned.com/post/91616626322/havenguard-turn-system
// Requires a fast max-heap Priority Queue (I like this one: http://blog.mischel.com/2007/06/22/priority-queue-in-c/)
public class TurnEntity
{
/// <summary>
/// The delegate to execute when the object's turn is executed.
/// </summary>
public Action TurnHandler { get; set; }