-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ab9053
commit 0b41330
Showing
9 changed files
with
316 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
/*.json | ||
overrides | ||
cache | ||
server | ||
server | ||
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
param([Parameter(Mandatory)][string]$version) | ||
$ErrorActionPreference = "Stop" | ||
|
||
$source = "C:\Games\CurseForge\Minecraft\Instances\All_The_Mods_0" | ||
$overridePath = "$PSScriptRoot\overrides" | ||
$manifestPath = "$PSScriptRoot\manifest.json" | ||
$tmpPath = "$PSScriptRoot\tmp" | ||
$modsPath = "$tmpPath\mods" | ||
$batPath = "$tmpPath\startserver.bat" | ||
$shPath = "$tmpPath\startserver.sh" | ||
|
||
$ignore = @( | ||
"297038", # CraftPresence | ||
"226447", # ResourceLoader | ||
"232131", # Default Options | ||
"231275", # Ding | ||
"268324", # Blur | ||
"238891", # Dynamic Surroundings | ||
"222789", # Sound Filters | ||
"296468", # NoFog | ||
"282313", # TipTheScales | ||
"256087", # Notes | ||
"226406", # Custom Main Menu | ||
"226188", # Default World Generator | ||
"238372", # Neat | ||
"229625", # WAILA-features | ||
"60089", # Mouse Tweaks | ||
"227441", # Fullscreen Windowed | ||
"235716", # Better Achievements | ||
"221849", # FogNerf | ||
"280294" # FPS Reducer | ||
) | ||
|
||
if ( -Not (Test-Path $source)) { | ||
Write-Host "No CurseForge instance found with the name All_The_Mods_0" -ForegroundColor Red | ||
exit 1 | ||
} | ||
|
||
if ( -Not (Test-Path $overridePath)) { | ||
Write-Host "Cloning configuration repo." | ||
git clone --branch main --depth 1 --single-branch https://github.com/AllTheMods/ATM-0.git $overridePath | ||
} | ||
|
||
Get-ChildItem $overridePath -Exclude "config", "scripts", "resources", "local" | Remove-Item -Recurse | ||
|
||
Write-Host "Loading CurseForge manifest..." | ||
Write-HOST "If you have added any mods, you MUST run the game once to update the Curseforge instance JSON.". | ||
$instancePath = "$source\minecraftinstance.json" | ||
$instanceJson = Get-Content $instancePath -raw | ConvertFrom-Json | ||
|
||
$forgeVersion = $instanceJson.baseModLoader.forgeVersion; | ||
Write-Host "Manifest uses Forge $forgeVersion." | ||
|
||
# start generate server pack | ||
|
||
$serverDest = "ATM0-dev-$version-server.zip" | ||
Write-Host "Writing server zip to: $serverDest" | ||
|
||
if (Test-Path $serverDest) { | ||
Write-Host "Removing existing export." | ||
Remove-Item $serverDest | ||
} | ||
|
||
|
||
New-Item -Path $modsPath -Type Directory -Force | Out-Null | ||
foreach($mod in $instanceJson.installedAddons) { | ||
if (-Not ($ignore -contains $mod.addonID)) { | ||
$filename = $mod.installedFile.FileNameOnDisk | ||
Copy-Item -LiteralPath "$source\mods\$filename" -Destination "$modsPath\$filename" | ||
} | ||
} | ||
|
||
Get-Content "$PSScriptRoot\templates\startserver-template-0.bat" -raw | % {$_.replace('@version@', $forgeVersion)} | Set-Content -NoNewline $batPath | ||
Get-Content "$PSScriptRoot\templates\startserver-template-0.sh" -raw | % {$_.replace('@version@', $forgeVersion)} | Set-Content -NoNewline $shPath | ||
|
||
$compress = @{ | ||
Path = @( | ||
"$overridePath/config", | ||
"$overridePath/scripts", | ||
"$overridePath/local", | ||
"$tmpPath/*" | ||
) | ||
CompressionLevel = "Fastest" | ||
DestinationPath = $serverDest | ||
} | ||
Compress-Archive @compress | ||
|
||
Write-Host "Created server archive - cleaning up." | ||
Remove-Item -Recurse -Force -Path $tmpPath | ||
|
||
# end generate server pack | ||
# start generate client pack | ||
|
||
Write-Host "Generating manifest for version: $version" | ||
$manifestJson = Get-Content "$PSScriptRoot\templates\manifest-template-atm0.json" -raw | ConvertFrom-Json | ||
|
||
$manifestJson.minecraft.modLoaders[0].id = "forge-${forgeVersion}" | ||
$manifestJson.version = $version | ||
|
||
foreach($mod in $instanceJson.installedAddons) { | ||
$manifestJson.files += @{ | ||
projectID = $mod.addonID | ||
fileID = $mod.installedFile.id | ||
required = $true | ||
} | ||
} | ||
|
||
$manifestJson | ConvertTo-Json -Depth 32 | Set-Content $manifestPath | ||
|
||
$dest = "ATM0-dev-$version.zip"; | ||
Write-Host "Writing client zip to: $dest" | ||
|
||
if (Test-Path $dest) { | ||
Write-Host "Removing existing export." | ||
Remove-Item $dest | ||
} | ||
|
||
$compress = @{ | ||
Path = $manifestPath, $overridePath | ||
CompressionLevel = "Fastest" | ||
DestinationPath = $dest | ||
} | ||
|
||
Compress-Archive @compress | ||
|
||
Write-Host "Created client archive - cleaning up." | ||
|
||
Remove-Item -Recurse -Force -Path $overridePath | ||
Remove-Item -Recurse -Force -Path $manifestPath | ||
|
||
# end generate client pack | ||
|
||
Write-Host "Finished." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
$ErrorActionPreference = "Stop" | ||
|
||
$source = "C:\Games\CurseForge\Minecraft\Instances\All_The_Mods_0" | ||
$overridePath = "$PSScriptRoot\overrides" | ||
|
||
if ( -Not (Test-Path $source)) { | ||
Write-Host "No CurseForge instance found with the name All_The_Mods_0" -ForegroundColor Red | ||
exit 1 | ||
} | ||
|
||
if ( -Not (Test-Path $overridePath)) { | ||
Write-Host "Cloning configuration repo." | ||
git clone --branch main --depth 1 --single-branch https://github.com/AllTheMods/ATM-0.git $overridePath | ||
} | ||
|
||
Get-ChildItem $overridePath -Exclude "config", "scripts", "resources", "local" | Remove-Item -Recurse | ||
|
||
Write-Host "Removing existing configuration." | ||
Get-ChildItem $source -Include "config", "scripts", "resources", "local" -Recurse -Depth 0 | Remove-Item -Recurse | ||
|
||
Write-Host "Copying new configuration." | ||
Copy-Item -Recurse -Path "$overridePath/*" -Include "config", "scripts", "resources", "local" -Destination $source | ||
|
||
Write-Host "Cleaning up." | ||
Remove-Item -Recurse -Force -Path $overridePath | Out-Null | ||
Write-Host "Finished." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"minecraft": { | ||
"version": "1.7.10", | ||
"modLoaders": [ | ||
{ | ||
"id": "forge-@version@", | ||
"primary": true | ||
} | ||
] | ||
}, | ||
"manifestType": "minecraftModpack", | ||
"overrides": "overrides", | ||
"manifestVersion": 1, | ||
"version": "@version@", | ||
"author": "ATM Team", | ||
"name": "All the Mods 0", | ||
"files": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
@echo off | ||
set MAX_RAM=6G | ||
set MIN_RAM=6G | ||
set FORGE_VERSION=@[email protected] | ||
:: To use a specific Java runtime, set an environment variable named ATM0_JAVA to the full path of java.exe. | ||
:: To disable automatic restarts, set an environment variable named ATM0_RESTART to false. | ||
:: To install the pack without starting the server, set an environment variable named ATM0_INSTALL_ONLY to true. | ||
set MIRROR=https://maven.allthehosting.com/releases/ | ||
set INSTALLER="%~dp0forge-1.7.10-%FORGE_VERSION%-installer.jar" | ||
set FORGE_URL="%MIRROR%net/minecraftforge/forge/1.7.10-%FORGE_VERSION%/forge-1.7.10-%FORGE_VERSION%-installer.jar" | ||
|
||
:JAVA | ||
if not defined ATM0_JAVA ( | ||
set ATM0_JAVA=java | ||
) | ||
|
||
"%ATM0_JAVA%" -version 1>nul 2>nul || ( | ||
echo Minecraft 1.7.10 requires Java 8 - Java not found | ||
pause | ||
exit /b 1 | ||
) | ||
|
||
:FORGE | ||
setlocal | ||
cd /D "%~dp0" | ||
if not exist "libraries" ( | ||
echo Forge not installed, installing now. | ||
if not exist %INSTALLER% ( | ||
echo No Forge installer found, downloading from %FORGE_URL% | ||
bitsadmin.exe /rawreturn /nowrap /transfer forgeinstaller /download /priority FOREGROUND %FORGE_URL% %INSTALLER% | ||
) | ||
|
||
echo Running Forge installer. | ||
"%ATM0_JAVA%" -jar %INSTALLER% -installServer | ||
) | ||
|
||
if not exist "server.properties" ( | ||
( | ||
echo allow-flight=true | ||
echo motd=All the Mods 0 | ||
echo level-type=RTG | ||
)> "server.properties" | ||
) | ||
|
||
if "%ATM0_INSTALL_ONLY%" == "true" ( | ||
echo INSTALL_ONLY: complete | ||
goto:EOF | ||
) | ||
|
||
:START | ||
"%ATM0_JAVA%" -Xmx%MAX_RAM% -Xms%MIN_RAM% -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=32M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar forge-1.7.10-%FORGE_VERSION%-universal.jar nogui | ||
|
||
if "%ATM0_RESTART%" == "false" ( | ||
goto:EOF | ||
) | ||
|
||
echo Restarting automatically in 10 seconds (press Ctrl + C to cancel) | ||
timeout /t 10 /nobreak > NUL | ||
goto:START |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/sh | ||
set -eu | ||
MAX_RAM=6G | ||
MIN_RAM=6G | ||
FORGE_VERSION=@[email protected] | ||
# To use a specific Java runtime, set an environment variable named ATM0_JAVA to the full path of java.exe. | ||
# To disable automatic restarts, set an environment variable named ATM0_RESTART to false. | ||
# To install the pack without starting the server, set an environment variable named ATM0_INSTALL_ONLY to true. | ||
MIRROR="https://maven.allthehosting.com/releases/" | ||
INSTALLER="forge-1.7.10-$FORGE_VERSION-installer.jar" | ||
FORGE_URL="${MIRROR}net/minecraftforge/forge/1.7.10-$FORGE_VERSION/forge-1.7.10-$FORGE_VERSION-installer.jar" | ||
|
||
pause() { | ||
printf "%s\n" "Press enter to continue..." | ||
read ans | ||
} | ||
|
||
if ! command -v "${ATM0_JAVA:-java}" >/dev/null 2>&1; then | ||
echo "Minecraft 1.7.10 requires Java 8 - Java not found" | ||
pause | ||
exit 1 | ||
fi | ||
|
||
cd "$(dirname "$0")" | ||
if [ ! -d libraries ]; then | ||
echo "Forge not installed, installing now." | ||
if [ ! -f "$INSTALLER" ]; then | ||
echo "No Forge installer found, downloading now." | ||
if command -v wget >/dev/null 2>&1; then | ||
echo "DEBUG: (wget) Downloading $FORGE_URL" | ||
wget -O "$INSTALLER" "$FORGE_URL" | ||
else | ||
if command -v curl >/dev/null 2>&1; then | ||
echo "DEBUG: (curl) Downloading $FORGE_URL" | ||
curl -o "$INSTALLER" -L "$FORGE_URL" | ||
else | ||
echo "Neither wget or curl were found on your system. Please install one and try again" | ||
pause | ||
exit 1 | ||
fi | ||
fi | ||
fi | ||
|
||
echo "Running Forge installer." | ||
"${ATM0_JAVA:-java}" -jar "$INSTALLER" -installServer | ||
fi | ||
|
||
if [ ! -e server.properties ]; then | ||
printf "allow-flight=true\nmotd=All the Mods 0\nlevel-type=RTG" > server.properties | ||
fi | ||
|
||
if [ "${ATM0_INSTALL_ONLY:-false}" = "true" ]; then | ||
echo "INSTALL_ONLY: complete" | ||
exit 0 | ||
fi | ||
|
||
while true | ||
do | ||
|
||
"${ATM0_JAVA:-java}" -Xmx$MAX_RAM -Xms$MIN_RAM -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=32M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar forge-1.7.10-$FORGE_VERSION-universal.jar nogui | ||
|
||
if [ "${ATM0_RESTART:-true}" = "false" ]; then | ||
exit 0 | ||
fi | ||
|
||
echo "Restarting automatically in 10 seconds (press Ctrl + C to cancel)" | ||
sleep 10 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters