Skip to content

Instantly share code, notes, and snippets.

Avatar

Jakub Szewczyk kubasz

View GitHub Profile
@kubasz
kubasz / KUtils.java
Created Aug 31, 2011
Tool Detection Code - Minecraft
View KUtils.java
public class KUtils {
static EnumToolMaterial matFromTool(ItemTool tool)
{
if(tool==Item.axeDiamond||tool==Item.pickaxeDiamond||tool==Item.hoeDiamond||tool==Item.shovelDiamond||tool==Item.swordDiamond)
{
return EnumToolMaterial.EMERALD;
}
if(tool==Item.axeGold||tool==Item.pickaxeGold||tool==Item.hoeGold||tool==Item.shovelGold||tool==Item.swordGold)
{
return EnumToolMaterial.GOLD;
@kubasz
kubasz / sums.sh
Last active Nov 30, 2017
Checksums of program outputs
View sums.sh
#!/bin/bash
# To run you need to:
# * Have compiled mem_sim.c to mem_sim in the same folder
# * Have mem_trace.txt in the same folder as this script
# * Save the script as sums.sh
# * Run: chmod +x sums.sh
# * Run: ./sums.sh
declare -A checksums
@kubasz
kubasz / SuperBlock.java
Created Oct 13, 2011
Dropping many blocks
View SuperBlock.java
@Override
public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f)
{
super.dropBlockAsItemWithChance(world,i,j,k,l,f);
dropBlockAsItem_do(world, i, j, k, new ItemStack(/* YOUR DROP */));
}
View BlockPigRain.java
package net.kubasz.kmod;
import java.util.Random;
import net.minecraft.src.Block;
import net.minecraft.src.BlockContainer;
import net.minecraft.src.EntityPig;
import net.minecraft.src.Material;
import net.minecraft.src.ModLoader;
import net.minecraft.src.TileEntity;