Skip to content

Instantly share code, notes, and snippets.

@MSourceCoded
MSourceCoded / shitpost.cs
Created December 21, 2014 15:32
Shitpost automator
namespace ShitPost {
class Program {
static void Main(string[] args) {
StringBuilder builder = new StringBuilder();
using (StreamReader sr = new StreamReader("D:\\bookmarks.html")) {
String line;
while ((line = sr.ReadLine()) != null) {
builder.AppendLine(line);
}
http://imgur.com/jDejzWA
@MSourceCoded
MSourceCoded / gist:4464c4b4297c05158538
Created December 12, 2014 12:58
Update all the things
echo off
set workDirs=Beheaded "Quantum Anomalies" SourceCodedCore Palettes MessingAbout
echo ..Working Dirs:
for /D %%i in (%workDirs%) do (
echo .... %%i
)
echo.
@MSourceCoded
MSourceCoded / gist:f62e320707befb6c0b16
Created December 8, 2014 08:08
Spirolaterals in 3D
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int meta, float xo, float yo, float zo) {
if (!world.isRemote) {
Block targetBlock = world.getBlock(x, y-1, z);
int targetMeta = world.getBlockMetadata(x, y-1, z);
if (targetBlock == null || targetBlock == Blocks.air)
targetBlock = Blocks.iron_block;
int order = 89;
The overhead for injecting my own GuiFactories is fairly small. 1-2 methods tops, getting the private field and adding a value to the hashmap inside. This is done once, at runtime.
However, forge uses reflection to create a GuiConfig each time you hit the button. You pass it a class name, it will crawl the constructors and instantiate it itself. This is done in an Instanced method (IModGuiFactory), but expects a Static value (class name). Letting us pass an instance would be much, much more efficient, as well as being miles more flexible.
@MSourceCoded
MSourceCoded / gist:7abef1fefc4df4e3f1c8
Created October 23, 2014 13:28
Python Number Guessing Game
# Number Guessing Game
# Binary Search method
# (go easy on me, I'm new with python)
def search(lowerBound, higherBound):
halfPoint = int((higherBound - lowerBound) / 2 + lowerBound) # Get the midpoint of the range, and translate it to the proper position (getting halfway)
print("Is your number: ", halfPoint) # Get the halfway point status from the player
result = input("")
public class Capture {
private static IntBuffer pixelBuffer;
private static int[] pixelValues;
public static int[] captureFrame() {
Minecraft mc = Minecraft.getMinecraft();
int x = mc.displayWidth;