Skip to content

Instantly share code, notes, and snippets.

@thvortex
thvortex / commands.py.patch
Created March 8, 2012 23:09
MCP 6.0 commands.py fix to handle Javadoc @ block tags in method/field descriptions
--- commands1.py 2012-03-04 01:56:04.000000000 -0600
+++ commands.py 2012-03-08 17:27:00.040003100 -0600
@@ -1524,6 +1524,7 @@
regexps = {
'field': re.compile(r'^ {4}(?:[\w$.[\]]+ )*(?P<name>field_[0-9]+_[a-zA-Z_]+) *(?:=|;)'),
'method': re.compile(r'^ {4}(?:[\w$.[\]]+ )*(?P<name>func_[0-9]+_[a-zA-Z_]+)\('),
+ 'javadoctag': re.compile(r'\s*(?<!{)@'),
}
wrapper = TextWrapper(width=120)
@thvortex
thvortex / gist:2052469
Created March 16, 2012 20:31
ModLoader.addLocalization() example
package net.minecraft.src;
public class mod_MetaBlocks extends BaseMod
{
public mod_MetaBlocks()
{
ModLoader.AddLocalization("tile.itemmeta.name", "Mallorn Leaves");
Block.blocksList[20] = null; // Avoid exception throw in Block() constructor
Block glass = new BlockGlassMeta(20, 49, Material.glass // ... the rest is the same as the "glass" static initializer in Blocks.java
@thvortex
thvortex / FontRenderer.java.patch
Created March 17, 2012 21:02
Fix for fading chat messages
diff --git a/src/minecraft/net/minecraft/src/FontRenderer.java b/src/minecraft/net/minecraft/src/FontRenderer.java
index a10060d..966f08b 100644
--- a/src/minecraft/net/minecraft/src/FontRenderer.java
+++ b/src/minecraft/net/minecraft/src/FontRenderer.java
@@ -154,7 +154,7 @@ public class FontRenderer
/**
* Render a single character with the default.png font at current (posX,posY) location.
*/
- private void renderDefaultChar(int par1)
+ private void renderDefaultChar(int par1, int color)
@thvortex
thvortex / FontRenderer.java.patch
Created March 17, 2012 21:39
Fade out text fix plus possible white text fix for buggy GL drivers
diff --git a/src/minecraft/net/minecraft/src/FontRenderer.java b/src/minecraft/net/minecraft/src/FontRenderer.java
index a10060d..ac492a6 100644
--- a/src/minecraft/net/minecraft/src/FontRenderer.java
+++ b/src/minecraft/net/minecraft/src/FontRenderer.java
@@ -154,7 +154,7 @@ public class FontRenderer
/**
* Render a single character with the default.png font at current (posX,posY) location.
*/
- private void renderDefaultChar(int par1)
+ private void renderDefaultChar(int par1, int color)
@thvortex
thvortex / GuiTexturedRect.java
Created March 20, 2012 17:14
Drawing a textured rectangle in a Minecraft GUI
// HOW TO DRAW A TEXTURED RECTANGLE IN A MINECRAFT GUI WITH THE TEXTURE SCALED TO FIT
//
//
// 1. You need an instance of RenderEngine. Using ModLoader you can obtain it with:
//
RenderEngine renderEngine = ModLoader.getMinecraftInstance().renderEngine;
// 2a. When your mod first starts, you need to load your texture into OpenGL. If your image
// file is on the classpath (i.e. inside minecraft.jar or inside your own mod's jar) then
// you can load it easily. Your image file should contain an alpha layer with only 0 or 255
@thvortex
thvortex / lanbans.patch
Created August 9, 2012 07:45
Prototype LANBans Minecraft mod (1.3.2)
diff --git a/src/minecraft/net/minecraft/src/CommandServerBan.java b/src/minecraft/net/minecraft/src/CommandServerBan.java
index d151938..f36d545 100644
--- a/src/minecraft/net/minecraft/src/CommandServerBan.java
+++ b/src/minecraft/net/minecraft/src/CommandServerBan.java
@@ -31,6 +31,12 @@ public class CommandServerBan extends CommandBase
BanEntry var4 = new BanEntry(par2ArrayOfStr[0]);
var4.setBannedBy(par1ICommandSender.getCommandSenderName());
+ MinecraftServer server = MinecraftServer.getServer();
+ if (server.isSinglePlayer() && server.getServerOwner().equalsIgnoreCase(par2ArrayOfStr[0]))
@thvortex
thvortex / gitdiff-w.patch
Created August 13, 2012 08:21
MCP Commands.unpackreobfclasses() change to build reobfuscated .zip with no temp files
diff --git a/runtime/commands.py b/runtime/commands.py
index cd7f615..6d81854 100644
--- a/runtime/commands.py
+++ b/runtime/commands.py
@@ -1490,6 +1490,7 @@ class Commands(object):
md5reoblk = {CLIENT: self.md5reobfclient, SERVER: self.md5reobfserver}
outpathlk = {CLIENT: self.dirreobfclt, SERVER: self.dirreobfsrv}
srglk = {CLIENT: self.srgsclient, SERVER: self.srgsserver}
+ zipoutlk = {CLIENT: 'client_mod.zip', SERVER: 'server_mod.zip'}
@thvortex
thvortex / minecraft_ff.patch
Created November 16, 2012 01:02
MCP 7.21 minecraft_ff.patch for FontRenderer.java
diff -r -U 3 minecraft\net\minecraft\src\FontRenderer.java minecraft_patched\net\minecraft\src\FontRenderer.java
--- minecraft\net\minecraft\src\FontRenderer.java Thu Nov 15 17:48:11 2012
+++ minecraft_patched\net\minecraft\src\FontRenderer.java Thu Nov 15 17:50:26 2012
@@ -611,8 +611,6 @@
case 10:
--var5;
break;
- case 32:
- var6 = var5;
case 167: