Skip to content

Instantly share code, notes, and snippets.

@Lothrazar
Lothrazar / build.gradle
Created May 13, 2026 04:53
automate copying an example config based on the mods generated config file(s) if any
// I like to commit example versions of the generated config files in the root /examples/ folder of a mod src repo
// this task automates that process
// run it whenever you update the mods configs, or hook it up to trigger off some other task in the workflow
tasks.register('syncExampleConfigs') {
group = 'documentation'
description = 'Copies generated example config files from run/config/ into examples/.'
@Lothrazar
Lothrazar / build.gradle
Last active May 3, 2026 16:57
publish to Modrinth minecraft gradle neoforge 1.21.1+
plugins {
id 'java-library'
id 'maven-publish'
id 'net.neoforged.moddev' version '2.0.141'
id 'idea'
// ... add this plugin
id 'com.modrinth.minotaur' version '2.8.7' apply false
}
@Lothrazar
Lothrazar / build.gradle
Last active May 3, 2026 16:55
publish to Curseforge minecraft gradle neoforge 1.21.1+
import net.darkhax.curseforgegradle.TaskPublishCurseForge
plugins {
id 'java-library'
id 'maven-publish'
id 'net.neoforged.moddev' version '2.0.141'
id 'idea'
id 'net.darkhax.curseforgegradle' version '1.1.25'
}
@Lothrazar
Lothrazar / swap.py
Created April 29, 2026 03:59
neoforge default gradle doesnt handle multi project repos, need to wrap tasks init in this if statement. Now they will work standalone and also within the multi-pass
import os
ROOT = r"C:\Users\USER\MyFiles\mc121"
OLD = """tasks.named('wrapper', Wrapper).configure {
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
// documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
// file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
// (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
@Lothrazar
Lothrazar / primer steps
Last active July 2, 2023 02:42
1.20 port steps with reminders and links
0. read https://gist.github.com/ChampionAsh5357/cf818acc53ffea6f4387fe28c2977d56
1. download https://files.minecraftforge.net/net/minecraftforge/forge/index_1.20.1.html
2. copy gradle files&folders
3. update settings.gradle plugin
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}
4. update meta-inf normal changes along with
version="${mod_version}" #mandatory
5. pack mcmeta (optional) "pack_format": 15
@Lothrazar
Lothrazar / cauldronInteraction.java
Created August 31, 2022 07:52
CauldronInteraction water recipe
private void setup(final FMLCommonSetupEvent event) {
event.enqueueWork(() -> {
CauldronInteraction WASH_PEEL = (state, level, pos, player, hand, stack) -> {
if (stack.is(Items.POTATO)) {
//replace all the item, be generous. we could instead stack.shrink and drop just one
player.setItemInHand(hand, new ItemStack(PotatoModRegistry.PEELED.get(), stack.getCount()));
LayeredCauldronBlock.lowerFillLevel(state, level, pos);
return InteractionResult.sidedSuccess(level.isClientSide);
}
return InteractionResult.PASS;
{
"multipart": [
{ "apply": { "model": "tinylightbulbs:block/part_base" }},
{ "when": { "color": "black" },
"apply": { "model": "tinylightbulbs:block/bulb_black", "uvlock": true }
},
{ "when": { "color": "blue" },
"apply": { "model": "tinylightbulbs:block/bulb_blue", "uvlock": true }
},
{ "when": { "color": "brown" },
@Lothrazar
Lothrazar / forge 1.18.2 porting to 1.19
Created June 19, 2022 16:32
forge 1.18.2 porting to 1.19
clone new copy of source code, dont use a 1.18 workspace.
IE make new root folder C:\code\mc119
git clone git@github.com:Lothrazar/ForgeTemplate.git
Download forge mdk zip. we will need the following files.
https://files.minecraftforge.net/net/minecraftforge/forge/index_1.19.html
@Lothrazar
Lothrazar / ExtractFluidMultiTarget.java
Last active March 21, 2022 18:58
Extracts fluids from the world in minecraft: cauldron, waterlogged block, water source in-world. Fills the given tank one buckets worth
// PUBLIC DOMAIN
public static void extractFluidFromBlock(Level level, BlockPos posTarget, IFluidHandler tank) {
//fills always gonna be one bucket but we dont know what type yet
//test if its a source block, or a waterlogged block
BlockState targetState = level.getBlockState(posTarget);
FluidState fluidState = level.getFluidState(posTarget);
if (targetState.hasProperty(BlockStateProperties.WATERLOGGED) && targetState.getValue(BlockStateProperties.WATERLOGGED) == true) {
//for waterlogged it is hardcoded to water
int simFill = tank.fill(new FluidStack(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), FluidAttributes.BUCKET_VOLUME), FluidAction.SIMULATE);
if (simFill == FluidAttributes.BUCKET_VOLUME
@Lothrazar
Lothrazar / end_stone_bricks.properties
Created September 25, 2020 02:04
end_stone_bricks.properties in assets/minecraft/optifine/ctm/yourfolder
matchBlocks=stone_bricks mossy_stone_bricks cracked_stone_bricks oak_planks spruce_planks acacia_planks birch_planks dark_oak_planks jungle_planks warped_planks crimson_planks polished_blackstone_bricks cracked_polished_blackstone_bricks purpur_block cobblestone end_stone polished_diorite polished_granite polished_andesite diorite granite andesite stone bricks nether_bricks sandstone cut_sandstone smooth_sandstone white_concrete orange_concrete magenta_concrete light_blue_concrete yellow_concrete lime_concrete pink_concrete gray_concrete light_gray_concrete cyan_concrete purple_concrete blue_concrete brown_concrete green_concrete red_concrete black_concrete terracotta white_terracotta orange_terracotta magenta_terracotta light_blue_terracotta yellow_terracotta lime_terracotta pink_terracotta gray_terracotta light_gray_terracotta cyan_terracotta purple_terracotta blue_terracotta brown_terracotta green_terracotta red_terracotta black_terracotta
connectBlocks=end_stone_bricks
method=overlay
tiles=0-16
connect=