Skip to content

Instantly share code, notes, and snippets.

View 3r1u5's full-sized avatar
🎯
Focusing

3r1u5

🎯
Focusing
View GitHub Profile
@williewillus
williewillus / 1132_to_114.xml
Last active July 16, 2022 02:14
1.13.2 -> 1.14 migration mappings
<?xml version="1.0" encoding="UTF-8"?>
<migrationMap>
<name value="1.13.2 to 1.14" />
<description value="1.13.2 to 1.14 MCP changes" />
<entry oldName="net.minecraft.GameVersion" newName="net.minecraft.util.MinecraftVersion" type="class" />
<entry oldName="net.minecraft.advancements.AdvancementList.Listener" newName="net.minecraft.advancements.AdvancementList.IListener" type="class" />
<entry oldName="net.minecraft.advancements.RequirementsStrategy" newName="net.minecraft.advancements.IRequirementsStrategy" type="class" />
<entry oldName="net.minecraft.advancements.criterion.AbstractCriterionInstance" newName="net.minecraft.advancements.criterion.CriterionInstance" type="class" />
<entry oldName="net.minecraft.block.Block.EnumOffsetType" newName="net.minecraft.block.Block.OffsetType" type="class" />
<entry oldName="net.minecraft.block.BlockAbstractBanner" newName="net.minecraft.block.AbstractBannerBlock" type="class" />
@mcenderdragon
mcenderdragon / Primer Forge Gradle Commands for 1.13 and later.md
Last active October 12, 2020 05:24
Short command list of what is now needed to setup forge and MDK

If a command breaks, use --no-daemon as the ForgeGradle currently doesn't uses it

Setup MDK (For Modders who want to create a mod)

@Jeraldy
Jeraldy / nn.java
Last active July 25, 2019 14:58
Implementing an Artificial Neural Network in Pure Java (No external dependencies)
/**
*
* @author Deus Jeraldy
* @Email: deusjeraldy@gmail.com
* BSD License
*/
// np.java -> https://gist.github.com/Jeraldy/7d4262db0536d27906b1e397662512bc
import java.util.Arrays;
@pardeike
pardeike / SimpleHarmonyTranspilerTutorial.md
Last active May 22, 2023 04:43
Simple Harmony Transpiler Tutorial

About
A hopefully easy tutorial on how to make a Transpiler with Harmony
Based on patching a method in the game RimWorld

Introduction

Writing transpilers is like writing a book about how to rewrite a cookbook to make it work for the age of microwave even if that cookbook was written before microwave ovens were invented. It requires good knowledge about the language the cookbook is written in and the topics and information models the cookbook author uses.

As such, writing a transpiler is way more complex and low level than writing a simple method that prefixes, postfixes or replaces an existing method. It is required to have good understanding in general C# programming and how to manipulate abstract data structures with respect to references and relative positioning. It also requires to know the language, in this case CIL, so you can manipulate the instructions without it to get into an illegal state.

@Zhentar
Zhentar / patchoperation.md
Last active November 12, 2023 23:06
Introduction to PatchOperation

There are 11 new "PatchOperation" actions we can perform to modify Defs without copying the whole thing. This in turn improves mod compatability dramatically - it allows two mods to modify different parts of the same Def without conflict. This guide only describes the basics of each operation available to us.

Patches go in xml files in a subfolder named "Patches" in your mod folder (So "MyMod\Patches", just like you might have "MyMod\Defs" or "MyMod\Textures"). Example.

Each PatchOperation has an "xpath" node, which should contain an xpath selector for the xml node(s) that the operation should affect. This is not an xpath tutorial. If you don't know xpath, not my problem. But minimurgle has you covered!

To illustrate the operations, I'll use this simple example def:

  <DesignationCategoryDef>
@Pokechu22
Pokechu22 / Setting up MCP without a full MCP release.md
Last active March 31, 2024 21:35
Setting up MCP for newer versions (e.g. 1.12.2)

It's possible to use create an MCP installation for versions of Minecraft where there hasn't been a full MCP release. It takes a little bit of manual setup, but the end result is highly useful.

  1. Download and extract the most recent MCP build from http://www.modcoderpack.com/. (Currently, the latest build is http://www.modcoderpack.com/files/mcp940.zip)

  2. Edit version.cfg in the conf folder, and change ClientVersion and ServerVersion to the version you want (for instance, 1.12.2).

  3. Download the SRG zip for the version you want; these can generally be found at http://mcpbot.bspk.rs/mcp/<version>/mcp-<version>-srg.zip (for example, http://mcpbot.bspk.rs/mcp/1.11.2/mcp-1.11.2-srg.zip) or at http://files.minecraftforge.net/maven/de/oceanlabs/mcp/mcp/<version>/mcp-<version>-srg.zip (for example, http://files.minecraftforge.net/maven/de/oceanlabs/mcp/mcp/1.12.2/mcp-1.12.2-srg.zip). (For 1.12.1 and 1.12.2, only the minecraftforge link works)

  4. Extract that zip into the MCP conf folder, over

<blockstate> == {
"forge_marker": 1,
"defaults": <variant>, // optional, added to all variants
"variants": {
"<property>": {
"<value>": <variant> // variant definition for the specified value of this property; variants for multiple values can be specified.
},
"<variant name>": <variant>, // variant definition for the full variant string
"<variant name>": [<variant1>, ...], // array of definitions for the full variant - result will be the random variant
}
@reima
reima / ButtonMod.cs
Last active September 2, 2022 06:44
using ColossalFramework.UI;
using ICities;
using UnityEngine;
namespace ButtonMod
{
public class ButtonMod : IUserMod
{
public string Name { get { return "Button"; } }
public string Description { get { return "Shows a button"; } }