Skip to content

Instantly share code, notes, and snippets.

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;
From 0e33e41ca6e711812d0a38fd20703bce74792545 Mon Sep 17 00:00:00 2001
From: David Quintana <[email protected]>
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(+)
@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
{
@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 / Register.java
Last active June 26, 2020 20:18
Separate perspective model
ModelLoaderRegistry.registerLoader(new ResourceLocation(MODID, "separate_perspective"), SeparatePerspectiveModel.Loader.INSTANCE);
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 / 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.
@gigaherz
gigaherz / 1152to1161.xml
Created June 26, 2020 19:42 — forked from sobrinth/1152to1161.xml
1.15.2 -> 1.16.1 migration mappings for intellij
<?xml version="1.0" encoding="UTF-8"?>
<migrationMap>
<name value="1.15.2 to 1.16.1" />
<description value="1.15.2 to 1.16.1 MCPConfig changes" />
<entry oldName="net.minecraft.entity.item.minecart.MinecartCommandBlockEntity" newName="net.minecraft.entity.item.minecart.CommandBlockMinecartEntity" type="class" />
<entry oldName="net.minecraft.util.math.Matrix3f" newName="net.minecraft.util.math.vector.Matrix3f" type="class" />
<entry oldName="net.minecraft.util.math.Matrix4f" newName="net.minecraft.util.math.vector.Matrix4f" type="class" />
<entry oldName="net.minecraft.util.math.Vector3f" newName="net.minecraft.util.math.vector.Vector3f" type="class" />
<entry oldName="net.minecraft.util.math.Vector4f" newName="net.minecraft.util.math.vector.Vector4f" type="class" />
<entry oldName="net.minecraft.util.math.Vec2f" newName="net.minecraft.util.math.vector.Vector2f" type="class" />
package gigaherz.signbutton;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType;
public class MultiplyAlphaRenderTypeBuffer implements IRenderTypeBuffer
{
private final IRenderTypeBuffer inner;
private final float constantAlpha;
public static <T extends IModPacket> void registerPacket(SimpleChannel channel, int discriminator, PacketHandler<T> handler)
{
channel.registerMessage(discriminator, handler.getPacketClass(), handler::encode, handler::decode, handler::handle);
}
public static abstract class PacketHandler<T extends IModPacket>
{
private final Class<T> tClass;