Commits

Jack Frost  committed 5a941be

initial digger<->enderman integration. Untested!

  • Participants
  • Parent commits 5ee50ad

Comments (0)

Files changed (1)

 	cp -r "$digger_dir/$1" "$digger_dir/$minecraft_instance"
 }
 
+digger.block() {
+	[[ "$enderman_path" ]] || { enderman_path=`which enderman`; }
+
+	[[ "$enderman_path" ]] || {
+		[[ -f 'enderman' ]] && { enderman_path="`pwd`/enderman"; }
+	}
+
+	[[ "$enderman_path" ]] || {
+		digger.err "miner not found. You can get it at https://github.com/fbt/misc or https://bitbucket.org/fbt/scripts"
+		return 1
+	}
+	
+	bash "$enderman_path" -d "$digger_dir/$minecraft_instance" "$1"
+}
+
+digger.exclude() {
+	[[ "$2" ]] && { echo "$1"; return 1; }
+}
+
 # Main part
-while getopts "chd:p:C:" option; do
+while getopts "chd:p:C:e:" option; do
 	case $option in
 		d) flag_get_jar='1'; jar_version="$OPTARG";;
 		p) flag_patch='1'; mod_zip="$OPTARG";;
 		c) flag_create='1';;
 		C) flag_clone='1'; clone_target="$OPTARG";;
+		e) flag_block='1'; block_target="$OPTARG";;
 		h|?|*) digger.usage; exit;;
 	esac
 done
 
 digger.env || exit 27
 
-[[ "$flag_create" ]] && { digger.new; }
+[[ "$flag_create" ]] && {
+	digger.exclude "-c and -d are mutually exclusive." "$flag_get_jar" || exit 17
+	digger.exclude "-c and -e are mutually exclusive." "$flag_block" || exit 31
+	digger.exclude "-c and -p are mutually exclusive." "$flag_patch" || exit 23
+	digger.new
+}
 
 [[ "$flag_clone" ]] && {
 	digger.clone "$clone_target" || exit 29
 }
 
 [[ "$flag_get_jar" ]] && {
-	[[ "$flag_create" ]] && {
-		digger.err "-c and -d are mutually exclusive. You have to have a working instance to substitute minecraft.jar"
-		exit 17
-	}
-
 	digger.get_jar || { exit 21; }
 }
 
-[[ "$flag_patch" ]] && {
-	[[ "$flag_create" ]] && {
-		digger.err "-c and -p are mutually exclusive. You have to have a working instance to patch minecraft.jar"
-		exit 23
-	}
+[[ "$flag_block" ]] && {
+	digger.block "$block_target"
+}
 
+[[ "$flag_patch" ]] && {
 	digger.patch || { exit 25; }
 }
 
-
 [[ -e "$minecraft_dir" ]] && {
 	[[ -h "$HOME/.minecraft" ]] && {
 		rm "$minecraft_dir"