Skip to content

Instantly share code, notes, and snippets.

/**
* Public domain.
*/
package net.minecraft.src;
import org.lwjgl.input.Keyboard;
/**
* @author Rob
*
@lahwran
lahwran / Chunkitertest.java
Created April 8, 2011 19:01
rough test of performance of iterating a minecraft chunk
public class Chunkitertest {
public static double getTime()
{
return ((double)System.currentTimeMillis()) / 1000D;
}
public static void main(String[] args) {
//this has some inaccuracies but oh well, it's plenty accurate for this
int chunkwidth = 16;
int chunkdepth = 16;
@lahwran
lahwran / decompile_asdf.java
Created April 23, 2011 04:14
Smart compiler is smart
//eclipse compiled and jd-gui decompiled
public class asdf
{
public static final int x = 10;
public int z = 3;
public asdf() {
int y = 11; //YES!!!
this.z += y;
}
@lahwran
lahwran / gist:939036
Created April 23, 2011 22:25
color multiplication
public int colorMult(int x, int y)
{
int res = 0;
for (int octet = 0; octet < 3; octet++)
{
int shift = (8*octet);
int xoct = (x & (0xff << shift)) >> shift;
int yoct = (y & (0xff << shift)) >> shift;
xoct *= yoct;
xoct /= 0xff;
java.lang.ArrayIndexOutOfBoundsException: 182792
at hl.a(SourceFile:23)
at vh.b(SourceFile:30)
at cn.j(cn.java:1292)
at cn.a(cn.java:95)
at dc.a(SourceFile:173)
at m.a(SourceFile:1110)
at oy.c(SourceFile:576)
at oy.b(SourceFile:498)
at EntityRendererProxy.b(EntityRendererProxy.java:14)
@lahwran
lahwran / gist:941418
Created April 25, 2011 22:43
irc.esper.net #Risucraft rules
#Risucraft Rules
1) Use Pastebin or Gist (this site) for error reports. Always.
2) No texttalk; slang is allowed in moderation. Text talk does not include more common internet expressions such as lol and wtf. It does include using letters that are not words as words, such as "u" to mean "you", and also includes words such as "plox" and "plz". If it's less than three letters and it's a word added to the dictionary since computers, it probably breaks this rule.
3) Do not argue with the modders over something regarding the code in the game. They will almost always prove you wrong.
4) If a modder doesn't want to help you with their mod and you keep on, they may ignore you.
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
import java.util.List;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
public class GuiGameOver extends GuiScreen
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
import java.util.List;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
public class GuiGameOver extends GuiScreen
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
import java.util.List;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
public class GuiGameOver extends GuiScreen
public class mod_test extends BaseMod {
public mod_test() {
ModLoader.SetInGameHook(this, true, false);
}
public void OnTickInGame(Minecraft game) {
String name = game.e.s.j();
if (name == null) name="blah";
game.p.a("Hello Minecraft World named "+name,5,15,0xffffff);