Skip to content

Instantly share code, notes, and snippets.

@ShaRose
ShaRose / ModAction.java
Created April 16, 2011 09:12
Patch so it will try and recursively find methods if it needs to.
/**
* 303's reflection callback api. warning: dangerously awesome. modified to be usable as a runnable. <br/>
* <br/>
* example: <br/>
* <br/>
* assuming x.addCallback takes a runnable: <br/>
* public void F(T x) <br/>
* { <br/>
* x.addCallback(new ModAction(this, "callback")); <br/>
* } <br/>
@ShaRose
ShaRose / gist:972982
Created May 15, 2011 08:59
Steam User ID Path Finder Method
/// <summary>
/// This gets a Dictionary of steam names and the user ID's needed to access, say, brink's settings.
/// </summary>
/// <returns>Dictionary<string,string>, Key is the steam display name, value is the userid path.</returns>
public static Dictionary<string,string> GetSteamProfiles()
{
string steampath;
try
{
steampath = (string) Registry.CurrentUser.OpenSubKey("Software\\Valve\\Steam").GetValue("SteamPath") + "//userdata";
@ShaRose
ShaRose / gist:973606
Created May 15, 2011 22:15
MCPified GuiWidgetScreen
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 de.matthiasmann.twl.GUI;
import de.matthiasmann.twl.Widget;
import de.matthiasmann.twl.input.lwjgl.LWJGLInput;
import de.matthiasmann.twl.renderer.lwjgl.LWJGLRenderer;
import de.matthiasmann.twl.theme.ThemeManager;
I don't even know where to begin with you. I guess I'll keep it nice and short since I really don't feel like doing a massive post.
The whole point of using ModLoader and other such APIs are for compatibility with other mods. That's it. It's not harder in most cases, indeed it's likely easier and requires less work. On the contrary, what you call 'regular' modding tends to break for even the simplest changes if you install another mod, entirely because the modder is lazy.
It doesn't need any tutorials to learn? Neither do APIs. If you prefer learning from looking at the code what exactly is stopping you from doing so to the APIs themselves? And what exactly are you going on about with "the difference between the original codes and the ones I'm working"? Are you porting a mod from non-ModLoader to ModLoader? If so, that's obviously going to be time consuming. It's because you are doing the work the original modder should have done in the first place!
Even with all of this, usually using APIs are better for
private static void SetupOverrides() {
try {
IDResolver.blockidfield = Block.class.getField("bA");
} catch (Throwable e) {
try {
IDResolver.blockidfield = Block.class.getField("blockID");
} catch (Throwable e2) {
try {
for (Field field : Block.class.getFields()) {
int mod = field.getModifiers();
package net.minecraft.src;
import java.lang.reflect.Method;
import java.util.Map;
public class mod_Goomba extends BaseMod
{
@Override
public void AddRenderer(Map map)
{
package net.minecraft.src;
public class EntityGoomba extends EntityCreature {
public EntityGoomba(World world) {
super(world);
texture = "/mob/Goomba.png";
moveSpeed = 1.0F;
isImmuneToFire = false;
npcName = "Goomba";
}
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.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Vector;
package net.minecraft.src;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import de.matthiasmann.twl.GUI;
import de.matthiasmann.twl.Widget;
public class WidgetItem2DRender extends Widget {
@ShaRose
ShaRose / oh god
Created March 12, 2012 03:25
#minecraft's netsplit
[Monday 12:48:55 am] |<-- Deltafire has left sharose.info:6694 (*.net *.split)
[Monday 12:48:56 am] |<-- Kobata has left sharose.info:6694 (*.net *.split)
[Monday 12:48:56 am] |<-- Keniyal_ has left sharose.info:6694 (*.net *.split)
[Monday 12:48:56 am] |<-- FrenchVerbs has left sharose.info:6694 (*.net *.split)
[Monday 12:48:56 am] |<-- pakman has left sharose.info:6694 (*.net *.split)
[Monday 12:48:56 am] |<-- Archelaus has left sharose.info:6694 (*.net *.split)
[Monday 12:48:56 am] |<-- Razer has left sharose.info:6694 (*.net *.split)
[Monday 12:48:57 am] |<-- Dokuro-chan has left sharose.info:6694 (*.net *.split)
[Monday 12:48:57 am] |<-- MogDog has left sharose.info:6694 (*.net *.split)
[Monday 12:48:57 am] |<-- Blumiere has left sharose.info:6694 (*.net *.split)