Skip to content

Instantly share code, notes, and snippets.

View AbrarSyed's full-sized avatar

Abrar Syed AbrarSyed

View GitHub Profile
task processSources(type: Copy) {
from (sourceSets.main.java) {
include "**/SpongeWorldEdit.java"
filter { line -> line.replaceAll("%VERSION%", project.version) }
}
from (sourceSets.main.java) {
exclude "**/SpongeWorldEdit.java"
}
into 'build/sources/main/java'
@AbrarSyed
AbrarSyed / ApplyCsv.groovy
Last active August 29, 2015 13:56
A script to help out with people updating their MCP mappings.
import java.util.Map;
import java.util.regex.Matcher;
// args[] is an array of the arguments..
// should be..
// srcDIr MethodCsv FieldCsv
// define constants
def METHOD = /func_[0-9]+_[a-zA-Z_]+/
def FIELD = /field_[0-9]+_[a-zA-Z_]+/
import groovy.json.JsonSlurper
import java.util.zip.ZipEntry
import java.util.zip.ZipFile
// This script renames files in the specified directory that have the name format something-something-version.ext
// they will be renamed to something-0something-mcversion-version.ext
// the mcversion information is taken from the mcmod.info file in each file.
// Files that do not follow the above naming convention, or do not have an mcmod.info file are ignored.
// takes 1 arg, jarDir.
@AbrarSyed
AbrarSyed / build.gradle
Last active August 29, 2015 13:58
A quick gist for how you partially sign a jar
jar {
from(sourceSets.main.output) {
include 'myPackages/**'
}
// set temp location
destinationDir = file("build/tmp")
archiveName = "signed.jar"
// sign it.
@AbrarSyed
AbrarSyed / update.sh
Created April 28, 2014 20:03
Update forgecraft
#! /bin/bash
game=some/place #/home/abrarsyed/pahicraft/ForgeCraft2_mc
seafile=some/other/place #/home/abrarsyed/pahicraft/instances/ForgeCraft2
# just to be sure
mkdir -p $game/config $game/mods $game/hats $game/resourcepacks
#sync mods and configs and hats
rsync -r --delete $seafile/mods $game
public interface IMultiBlockHandler
{
public void addMember(World world, int x, int y, int z);
public void addSpecialHandler(Object obj);
}
@AbrarSyed
AbrarSyed / build.gradle
Last active August 29, 2015 14:02
Put these in a folder, clone projects to that folder to your hearts content. Then run ```` gradle build``` and all the mods will be built and put in the output folder for you. DISCLAIMER: may not work perfectly for all mods
task build
task clean
task setup
ext.output = new File(rootProject.projectDir, "output")
subprojects {
afterEvaluate {
// not using ForgeGradle? skipping you.
if (!hasPlugin("forge") && !hasPlugin("fml") && !hasPlugin("liteloader"))
@AbrarSyed
AbrarSyed / ModjamBuild.gradle
Last active August 29, 2015 14:03
A Starter build.gradle for people to use for Modjam
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
@AbrarSyed
AbrarSyed / hash.groovy
Created July 3, 2014 23:28
Easy hashing. Generates all the .sha1 and .md5 files for all files recursively.
#!/usr/bin/env groovy
File root;
if (args.length == 0)
root = new File('.').getCanonicalFile()
else
root = new File(args[0])
root.eachFileRecurse(FileType.FILES) { file ->
package net.minecraftforge.permissions.api;
import net.minecraft.entity.player.EntityPlayer;
import java.util.Collection;
import java.util.UUID;
/**
* A group object in the API.
*