1
0
mirror of https://github.com/chylex/Hardcore-Ender-Expansion-2.git synced 2025-04-11 03:15:44 +02:00

Maximize client/server window when debugging

This commit is contained in:
chylex 2018-09-08 11:21:11 +02:00
parent a47db662bc
commit 479815d194
3 changed files with 16 additions and 3 deletions
.gitignore
run
src/main/java/chylex/hee/system

6
.gitignore vendored
View File

@ -24,6 +24,6 @@ bin
build
.gradle
# other
eclipse
run
# game
run/*
!run/maximize.ps1

3
run/maximize.ps1 Normal file
View File

@ -0,0 +1,3 @@
Param([Parameter(Mandatory = $True, Position = 1)][string] $processId)
Add-Type -MemberDefinition '[DllImport("user32.dll")]public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);' -Name Functions -Namespace Win32
[Win32.Functions]::ShowWindow((Get-Process -Id $processId).MainWindowHandle, 3)

View File

@ -3,8 +3,13 @@ import chylex.hee.HardcoreEnderExpansion
import net.minecraftforge.fml.common.FMLCommonHandler
import net.minecraftforge.fml.relauncher.Side.CLIENT
import net.minecraftforge.fml.relauncher.Side.SERVER
import org.lwjgl.LWJGLUtil
import org.lwjgl.LWJGLUtil.PLATFORM_WINDOWS
import org.lwjgl.opengl.Display
import java.awt.GraphicsEnvironment
import java.io.File
import java.io.FileOutputStream
import java.lang.management.ManagementFactory
import java.util.Properties
object Debug{
@ -29,6 +34,11 @@ object Debug{
}
}
}
if (LWJGLUtil.getPlatform() == PLATFORM_WINDOWS && !GraphicsEnvironment.isHeadless() && File("maximize.ps1").exists()){
val pid = ManagementFactory.getRuntimeMXBean().name.split("@")[0]
ProcessBuilder("powershell.exe", "-ExecutionPolicy", "Unrestricted", "-File", "maximize.ps1", pid).start()
}
}
}
}