Skip to content

Instantly share code, notes, and snippets.

View Unh0lyTigg's full-sized avatar

Robert Allen Unh0lyTigg

View GitHub Profile
@Unh0lyTigg
Unh0lyTigg / RectsArea.java
Last active December 23, 2015 14:09
Compute the overall area of some rectangles...
public class RectsArea {
public static long area(java.awt.Rectangle... rects) {
if (rects == null)
return 0;
java.awt.Rectangle massArea = null;
for (java.awt.Rectangle r : rects)
if (massArea == null)
massArea = r;
else
massArea = massArea.union(r);
@Unh0lyTigg
Unh0lyTigg / ItemTexture.java
Created December 27, 2013 08:58
Centralized item information
import java.util.Map;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import com.google.common.collect.Maps;
public class ItemTexture {
public static final ItemTexture INSTANCE = new ItemTexture();
private final Map<Integer, Map<Integer, String>> map;
@Unh0lyTigg
Unh0lyTigg / Container.java
Created May 21, 2014 09:26
Container.transferStackInSlot(EntityPlayer, int)
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
ItemStack itemstack = null;
Slot slot = (Slot)this.inventorySlots.get(par2);
if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (par2 < this.tile.getSizeInventory())
if (!this.mergeItemStack(itemstack1, this.tile.getSizeInventory(), this.inventorySlots.size(), true))
return null;
else if (!this.mergeItemStack(itemstack1, 0, this.tile.getSizeInventory(), false))
@Unh0lyTigg
Unh0lyTigg / CraftingRecipeBuilder.java
Last active August 29, 2015 14:02
CraftingRecipeBuilder
package net.minecraftforge.common;
import java.util.List;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
@Unh0lyTigg
Unh0lyTigg / chips.json
Created June 27, 2014 21:36
Proposed simple CircuitBoards chip creation.
[
{
"ic_part":"7400",
"description":"quad 2-input NAND gate",
"pin_count":14,
"pins": [
{
"pin":1,
"name":"1A",
"description":"Input A of gate 1",
@Unh0lyTigg
Unh0lyTigg / GuiIDs.java
Created July 2, 2014 04:22
GuiIDs.java
package org.unh0lytigg.circuitboards.guisystem;
import org.unh0lytigg.circuitboards.inventory.ContainerConfiguration;
public enum GuiIDs {
BUILDER,
SIMULATOR,
CHIPSELECTOR,
TOOLBOX,
TOOLBOX_LARGE,
@Unh0lyTigg
Unh0lyTigg / MinecraftAsciiSpacer.java
Created July 7, 2014 07:01
MinecraftAsciiSpacer
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
@Unh0lyTigg
Unh0lyTigg / gist:ccd5c769654df15637c5
Created July 7, 2014 09:09
non-Minecraft facsimile of Minecraft's glint rendering code
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glBindTexture(glintTextureId);
GL11.glEnable(GL11.GL_BLEND);
if (GLContext.getCapabilities().OpenGL14) {
if (GLContext.getCapabilities().GL_EXT_blend_func_separate) {
EXTBlendFuncSeparate.glBlendFuncSeparateEXT(GL11.GL_SRC_COLOR, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO);
} else {
GL14.glBlendFuncSeparate(GL11.GL_SRC_COLOR, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO);
}
@Unh0lyTigg
Unh0lyTigg / build.gradle
Created July 20, 2014 11:25
custom source attachment for CBs mods
configurations {
attachThisSource
}
dependencies {
compile 'codechicken:CodeChickenCore:1.7.10-1.0.2.11:dev'
compile 'codechicken:CodeChickenLib:1.7.10-1.1.1.95:dev'
compile 'codechicken:ForgeMultipart:1.7.10-1.1.0.297:dev'
compile 'codechicken:NotEnoughItems:1.7.10-1.0.2.28:dev'
attachThisSource 'codechicken:CodeChickenCore:1.7.10-1.0.2.11:src'
<body>
<header>
<a href="index.html" id="logo">
<h1>Unh0ly_Tigg</h1>
<h2>Minecraft Modding</h2>
</a>
<nav>
<ul>
<li><a href="index.html" class="selected">Home</a></li>
<li><a href="mods.html">Mods</a></li>