Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

xJayr's Mod installer for mac


  • Please log in to reply
98 replies to this topic

#1

xjayr
    xjayr

    Coal Miner

  • Members
  • 101 posts

Posted 14 November 2010 - 08:13 PM

ModInstaller is basically an applescript app that installs your mods

nwTjSY9urzM

How To Use:
-Place mods in mods folder (class files)
-Run the Script

Keep In Mind:
-After you run the Script it will automatically close
-for MAC ONLY
-The Installer doen't really install the mods, The installer places the class files in the minecraft.jar
-Doesn't work with 1.5 I think...

DOWNLOAD

MCInstall : Terminal based
Download
works same way as Modinstaller does it just opens terminal then installs
use this if Modinstaller doesn't work for you.(I have no idea why it wouldn't work)

PLEASE NOTE: I'm a beginner at coding

Register or log in to remove.

#2

tali
    tali

    Zombie Killer

  • Members
  • 204 posts

Posted 14 November 2010 - 08:23 PM

Mine's sexier.  But I like that you posted a script instead of a tutorial.  Did you borrow that code from anybody?  It looks very familiar.
Mod Installing Hack for Mac
Just add a folder name “MCPatches” to your ~/Documents/ folder.
Open inside AppleScript Editor for gritty details.

#3

xjayr
    xjayr

    Coal Miner

  • Members
  • 101 posts

Posted 14 November 2010 - 08:27 PM

tali said:

Mine's sexier.  But I like that you posted a script instead of a tutorial.  Did you borrow that code from anybody?  It looks very familiar.
I borrowed some from Risugami for his mac one.
Then I took a look at Zan's minimap installer.

My original commands before looking at Zan's Installer made it so you needed to place the mods into a Jar which wasnt that easy IMO.

#4

tali
    tali

    Zombie Killer

  • Members
  • 204 posts

Posted 14 November 2010 - 08:30 PM

If you want I could show you how to convert that to an AppleScript Application so you can add drag and drop support, or simply make it fit better into the standard OS work flow.
Mod Installing Hack for Mac
Just add a folder name “MCPatches” to your ~/Documents/ folder.
Open inside AppleScript Editor for gritty details.

#5

xjayr
    xjayr

    Coal Miner

  • Members
  • 101 posts

Posted 14 November 2010 - 08:32 PM

tali said:

If you want I could show you how to convert that to an AppleScript Application so you can add drag and drop support, or simply make it fit better into the standard OS work flow.
Yeah I would like to know how to make that into an applescript App
before I made the command I tried using the applescript editor to do terminal commands O_o

#6

tali
    tali

    Zombie Killer

  • Members
  • 204 posts

Posted 14 November 2010 - 08:47 PM

Well, that's actually exactly what I do.  Download my mod installing hack, then open up applescript editor and then open the hack from inside applescript editor(yes I know it's a pain, but right-clicking in finder won't work).

I use other tricks when I want to talk about something being in a relative location to where the script lives, but let's wait on that until after you see how to make a basic shell command into an applescript call.

This is a wrapper I used to use to maintain my texture pack and to unlink and relink worlds.  It is retired, and this is an old version, but it may give some insight into how to write a rather complex hybrid script.
Mod Installing Hack for Mac
Just add a folder name “MCPatches” to your ~/Documents/ folder.
Open inside AppleScript Editor for gritty details.

#7

xjayr
    xjayr

    Coal Miner

  • Members
  • 101 posts

Posted 14 November 2010 - 08:57 PM

so taking a look at the script i see it
opens the bin folder
does some kind of backup
deletes the meta inf
my question: how does it open the jar?

#8

tali
    tali

    Zombie Killer

  • Members
  • 204 posts

Posted 14 November 2010 - 09:00 PM

mkdir minecraft && cd minecraft && jar xf ../minecraft.jar ;

creates the temporary folder named minecraft (and if successful) goes there (and if successful) uses jar to extract.
Mod Installing Hack for Mac
Just add a folder name “MCPatches” to your ~/Documents/ folder.
Open inside AppleScript Editor for gritty details.

#9

xjayr
    xjayr

    Coal Miner

  • Members
  • 101 posts

Posted 14 November 2010 - 09:04 PM

tali said:

mkdir minecraft && cd minecraft && jar xf ../minecraft.jar ;

creates the temporary folder named minecraft (and if successful) goes there (and if successful) uses jar to extract.


cp ~/Documents/MCPatches/* . ;  does this open up the folder we needed to place the mods in?
Im pretty sure it does. now how does it take all the stuff in mcpatches and puts it in the new folder it made

#10

xjayr
    xjayr

    Coal Miner

  • Members
  • 101 posts

Posted 14 November 2010 - 09:07 PM

xjayr said:

tali said:

mkdir minecraft && cd minecraft && jar xf ../minecraft.jar ;

creates the temporary folder named minecraft (and if successful) goes there (and if successful) uses jar to extract.


cp ~/Documents/MCPatches/* . ;  does this open up the folder we needed to place the mods in?
Im pretty sure it does. now how does it take all the stuff in mcpatches and puts it in the new folder it made


hmm that was stupid. im guessing cp means to extract everything in that location to the current one

#11

tali
    tali

    Zombie Killer

  • Members
  • 204 posts

Posted 14 November 2010 - 09:09 PM

xjayr said:

tali said:

mkdir minecraft && cd minecraft && jar xf ../minecraft.jar ;

creates the temporary folder named minecraft (and if successful) goes there (and if successful) uses jar to extract.


cp ~/Documents/MCPatches/* . ;  does this open up the folder we needed to place the mods in?
Im pretty sure it does. now how does it take all the stuff in mcpatches and puts it in the new folder it made

Actually, not quite, cp is short for copy and it copies from "~/Documents/MCPatches/*" to ".", in Unix parlance "." is the name of the current working directory.  Which was set in the line quoted above.  "cd" stands for "change directory".
Mod Installing Hack for Mac
Just add a folder name “MCPatches” to your ~/Documents/ folder.
Open inside AppleScript Editor for gritty details.

#12

xjayr
    xjayr

    Coal Miner

  • Members
  • 101 posts

Posted 14 November 2010 - 09:21 PM

edit: NVM see below

#13

xjayr
    xjayr

    Coal Miner

  • Members
  • 101 posts

Posted 14 November 2010 - 09:28 PM

do shell script ¬
	"cd ~/Library/Application\\ Support/minecraft/bin  ;
mkdir Temporary && cd Temporary && jar xf ../minecraft.jar ; 
rm -r meta-inf || rm -r META-INF; 
cp ~/Desktop/Mods/* .;
jar cMf ../minecraft.jar ./ && cd .. ;
rm -rf Temporary"

Thats what im using for the code.
if possible how would i make it so that the mods folder has to be in the same directory as the script app?

#14

tali
    tali

    Zombie Killer

  • Members
  • 204 posts

Posted 14 November 2010 - 09:37 PM

now we are talking about some trickier stuff.
Application bundles are secretly folders, something you can find out by right clicking an app and selecting "Show Package Contents" this is important, because when you ask applescript to give you your current location it will be the location of the script itself.
set myPath to POSIX path of (path to me)
will place the path of the application bundle(if it is one) as the variable myPath.  Or if it is not an application bundle the path to the script.

Assuming you are writing it as an app bundle remember that the folder indicated by that variable is the bundle itself, NOT it's containing folder.

As a shell command is just a string (prefaced with "do shell script") you can use & to concatenate.  Full examples of this sort of complex manipulation of shell and applescript are available in that other package I linked you to.  Happy to answer any questions you have.  The more expert mac users we have the better.

EDIT: BTW ¬ is generated by pressing
Mod Installing Hack for Mac
Just add a folder name “MCPatches” to your ~/Documents/ folder.
Open inside AppleScript Editor for gritty details.

#15

xjayr
    xjayr

    Coal Miner

  • Members
  • 101 posts

Posted 14 November 2010 - 09:57 PM

woah you just mesed me up right there...
so after placing the code in
set myPath to POSIX path of (path to me)
do shell script ¬
   "cd ~/Library/Application\\ Support/minecraft/bin  ;
mkdir Temporary && cd Temporary && jar xf ../minecraft.jar ; 
rm -r meta-inf || rm -r META-INF; 
cp ~/Desktop/Mods/* .;
jar cMf ../minecraft.jar ./ && cd .. ;
rm -rf Temporary"
what do i do now?

#16

tali
    tali

    Zombie Killer

  • Members
  • 204 posts

Posted 14 November 2010 - 09:59 PM

set myPath to POSIX path of (path to me)
do shell script ¬
   "cd ~/Library/Application\\ Support/minecraft/bin  ;
mkdir Temporary && cd Temporary && jar xf ../minecraft.jar ; 
rm -r meta-inf || rm -r META-INF; 
cp " & myPath & "/Mods/* .;
jar cMf ../minecraft.jar ./ && cd .. ;
rm -rf Temporary"
fix'd :Black:
I think.
Mod Installing Hack for Mac
Just add a folder name “MCPatches” to your ~/Documents/ folder.
Open inside AppleScript Editor for gritty details.

#17

xjayr
    xjayr

    Coal Miner

  • Members
  • 101 posts

Posted 14 November 2010 - 10:09 PM

hmm i tried running ur fixed one but it doesnt install the mods?

#18

xjayr
    xjayr

    Coal Miner

  • Members
  • 101 posts

Posted 14 November 2010 - 10:29 PM

been 30 minutes any help?

#19

tali
    tali

    Zombie Killer

  • Members
  • 204 posts

Posted 14 November 2010 - 10:54 PM

set myPath to POSIX path of (path to me)
do shell script ¬
   "cd ~/Library/Application\\ Support/minecraft/bin  ;
mkdir Temporary && cd Temporary && jar xf ../minecraft.jar ; 
rm -r meta-inf || rm -r META-INF; 
cp \"" & myPath & "../Mods/\"* .;
jar cMf ../minecraft.jar ./ && cd .. ;
rm -rf Temporary"
minor mistake :D had to play minecraft for a while and I am about to be gone for the day.
I told you that was going to happen but i forgot it myself.
.. stands for directory below me, which since modinstaller.app is one level too high this is the solution.

the \" are to avoid escaping spaces.
Mod Installing Hack for Mac
Just add a folder name “MCPatches” to your ~/Documents/ folder.
Open inside AppleScript Editor for gritty details.

#20

xjayr
    xjayr

    Coal Miner

  • Members
  • 101 posts

Posted 15 November 2010 - 07:17 AM

thank you for fixing that I'll give you additional credit as this really help :)