Skip to content

Instantly share code, notes, and snippets.

@gigaherz
gigaherz / tags.md
Created June 24, 2020 15:53
Minecraft tags convention

Tag Naming Convention

Tags are essentially grouping of items. There's an infinite number of ways to group them, but for the sake of understanding each other, here's what has been the ongoing convention since 1.13 introduced them.

Some basic rules

  1. Do not add tags to the minecraft namespace. Only add your things to existing tags only if you want your things to be used in recipes that might expect vanilla inputs. Example: only add something to the minecraft:wooden_buttons if your block is a redstone button, and is made of some kind of wood.
  2. Add your tag to the forge namespace only if it is designed to be grouped along with other tag files provided by other mods.
  3. Add your tag to some other mods' namespace only if it is designed to complement that mod's crafting logic / gameplay logic.
package gigaherz.survivalist.util;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.vertex.VertexBuffer;
import net.minecraft.client.renderer.vertex.VertexFormat;
@gigaherz
gigaherz / Register.java
Last active June 26, 2020 20:18
Separate perspective model
ModelLoaderRegistry.registerLoader(new ResourceLocation(MODID, "separate_perspective"), SeparatePerspectiveModel.Loader.INSTANCE);
@gigaherz
gigaherz / pr-to-forge.md
Last active February 13, 2020 15:13
How to make a PR to forge, step by step

How to make a PR to forge, steps

  1. create a personal fork if you don't yet have one

  2. clone the main repository to your pc, and add your personal fork as a secondary remote (after cloning) -- if you did it the other way around, it's fine, you just have to make sure you pull tags from the main repository, and not your fork!

    if you already have a local clone, fetch from the main repository to make sure you have the latest commit

  3. create a new work branch based off the correct branch, eg like, upstream/1.15.x

  4. run gradlew setup and gradlew gen*Runs

  5. do the thing and the changes, and test that it works as expected. write or update a test mod if the feature calls for it (as RenderNameplateEvent would)

  6. run gradlew build to make sure it doesn't error when building, and gradlew genPatches to update the patch files with your changes (I recommend doing that often, as a backup strategy)

@gigaherz
gigaherz / ReaderNBTLE.java
Last active April 4, 2020 15:30
Reader for bedrock mcstructure files into in-memory java edition NBT. The rest of the conversion process is left as an exercise to the reader.
package gigaherz.survivalist.util;
import net.minecraft.nbt.*;
import net.minecraftforge.common.util.Constants;
import java.io.FileInputStream;
import java.io.IOException;
public class ReaderNBTLE
{
From 0e33e41ca6e711812d0a38fd20703bce74792545 Mon Sep 17 00:00:00 2001
From: David Quintana <gigaherz@gmail.com>
Date: Mon, 5 Aug 2019 01:40:44 +0200
Subject: [PATCH] Netty logging
---
src/fmllauncher/resources/log4j2.xml | 1 +
.../logging/ForgeNettyLogger.java | 504 ++++++++++++++++++
.../minecraftforge/userdev/LaunchTesting.java | 4 +
3 files changed, 509 insertions(+)
package gigaherz.survivalist.rack;
import com.google.common.collect.Lists;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import javax.vecmath.Matrix4f;
import javax.vecmath.Vector4f;
import java.util.Arrays;
{"sidebarBg":"#23252c","sidebarText":"#ffffff","sidebarUnreadText":"#ffffff","sidebarTextHoverBg":"#2a2d34","sidebarTextActiveBorder":"#196caf","sidebarTextActiveColor":"#ffffff","sidebarHeaderBg":"#363a42","sidebarHeaderTextColor":"#ffffff","onlineIndicator":"#399fff","awayIndicator":"#c1b966","dndIndicator":"#e81023","mentionBj":"#0177e7","mentionColor":"#ffffff","centerChannelBg":"#2a2d34","centerChannelColor":"#dddddd","newMessageSeparator":"#cc992d","linkColor":"#0d93ff","buttonBg":"#0177e7","buttonColor":"#ffffff","errorTextColor":"#ff6461","mentionHighlightBg":"#784098","mentionHighlightLink":"#a4ffeb","codeTheme":"monokai","mentionBg":"#0177e7"}

An attempt at explaining the purpose and design of capabilities

Capabilitites are a concrete solution to an abstract problem.

The problem

In order to implement an api like RF, you have to implement interfaces in your tileentities or items or such. If you are implementing 20 different APIs for a tech mod they pile up into the same TE-

class MyTileEntity extends TileEntity implements EnergyInterface1, EnergyInterface2, EnergyInterface3, FluidsInterface1, FluidsInterface2, FluidsInterface3, ItemsApi1, ItemsApi2, ItemsApi3, ComputerApi1, ComputerApi2, ...
// ==UserScript==
// @name Down with the Circles!
// @namespace https://gist.github.com/gigaherz/cee1af98c298dbeea14f12986307fdf0
// @version 0.4
// @description Changes the circleness of twitter avatars.
// @author gigaherz
// @match https://twitter.com/*
// @grant GM_addStyle
// ==/UserScript==