mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-25 05:55:41 -04:00
Increase JVM memory pool in gradle script
Allow debug card to insert huge amounts of items, e.g. to fill infinity chest
This commit is contained in:
parent
9e869814d4
commit
72793aff25
2
gradlew
vendored
2
gradlew
vendored
@ -44,7 +44,7 @@ APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
DEFAULT_JVM_OPTS='"-Xmx2G" "-Xms128m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
2
gradlew.bat
vendored
2
gradlew.bat
vendored
@ -30,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
set DEFAULT_JVM_OPTS="-Xmx2G" "-Xms128m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
@ -619,7 +619,7 @@ object DebugCard {
|
||||
if (item == null) {
|
||||
throw new IllegalArgumentException("invalid item id")
|
||||
}
|
||||
val count = args.checkInteger(1)
|
||||
var count = args.checkInteger(1)
|
||||
val damage = args.checkInteger(2)
|
||||
val tagJson = args.optString(3, "")
|
||||
val tag = if (Strings.isNullOrEmpty(tagJson)) null else JsonToNBT.func_150315_a(tagJson).asInstanceOf[NBTTagCompound]
|
||||
@ -629,7 +629,22 @@ object DebugCard {
|
||||
case Some(inventory) =>
|
||||
val stack = new ItemStack(item, count, damage)
|
||||
stack.setTagCompound(tag)
|
||||
result(InventoryUtils.insertIntoInventory(stack, inventory, Option(side)))
|
||||
val res = InventoryUtils.insertIntoInventory(stack, inventory, Option(side), count)
|
||||
if (!res)
|
||||
result(res)
|
||||
else {
|
||||
var stored = count - stack.stackSize
|
||||
while (stored > 0 && stack.stackSize > 0) {
|
||||
count = stack.stackSize
|
||||
// InventoryUtils.insertIntoInventory honors max stack size for the stack,
|
||||
// but debug card may ignore that e.g. for infinity chest
|
||||
// so we try to insert the rest until we fail
|
||||
if (!InventoryUtils.insertIntoInventory(stack, inventory, Option(side), count))
|
||||
return result(true)
|
||||
stored = count - stack.stackSize
|
||||
}
|
||||
result(true)
|
||||
}
|
||||
case _ => result(Unit, "no inventory")
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user