From 8d357101c77b4f680c6d9e8aae047c9a81e5f271 Mon Sep 17 00:00:00 2001 From: repo_alt Date: Wed, 2 Jun 2021 16:41:10 +0300 Subject: [PATCH] Make fluid transfer speed configurable https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/7919 --- build.gradle | 39 ++----------------- build.properties | 2 +- src/main/resources/application.conf | 5 +++ src/main/scala/li/cil/oc/Settings.scala | 2 +- .../component/traits/InventoryTransfer.scala | 3 +- 5 files changed, 12 insertions(+), 39 deletions(-) diff --git a/build.gradle b/build.gradle index 10abe5c34..bd9063214 100644 --- a/build.gradle +++ b/build.gradle @@ -2,8 +2,8 @@ buildscript { repositories { mavenCentral() maven { - name = "forge" - url = "https://files.minecraftforge.net/maven" + name = "gt" + url = "https://gregtech.overminddl1.com/" } maven { name = "sonatype" @@ -14,16 +14,13 @@ buildscript { } } dependencies { - classpath 'com.github.CDAGaming:ForgeGradle:1c670759c5' - classpath 'com.github.CDAGaming:CurseGradle:184e4322fd' + classpath 'com.github.GTNH2:ForgeGradle:FG_1.2-SNAPSHOT' } } apply plugin: 'scala' apply plugin: 'forge' apply plugin: 'idea' -apply plugin: 'maven-publish' -apply plugin: 'com.matthewprenger.cursegradle' tasks.withType(ScalaCompile) { scalaCompileOptions.additionalParameters = ["-deprecation:false"] @@ -263,36 +260,6 @@ artifacts { archives sourcesJar } -publishing { - publications { - mavenJava(MavenPublication) { - artifact jar - artifact apiJar - artifact javadocJar - artifact sourcesJar - artifact deobfJar { classifier 'dev' } - } - } - repositories { - maven { - url System.getenv("MAVEN_PATH") - } - } -} - -curseforge { - apiKey = project.hasProperty("curseForgeApiKey") ? project.curseForgeApiKey : "" - project { - id = config.curse.project.id - releaseType = config.curse.project.releaseType - changelogType = "markdown" - changelog = file("changelog.md") - addGameVersion config.minecraft.version - addGameVersion "Java 8" - mainArtifact jar - } -} - // this is needed for IntelliJ so we don't have to copy over the assets manually every time idea { module { diff --git a/build.properties b/build.properties index ec8ebf4d3..3b06b3993 100644 --- a/build.properties +++ b/build.properties @@ -1,7 +1,7 @@ minecraft.version=1.7.10 forge.version=10.13.4.1614-1.7.10 -oc.version=1.7.5.10-GTNH +oc.version=1.7.5.11-GTNH ae2.version=rv3-beta-31 bc.version=7.0.9 diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf index 9312cf05f..e09d51d1a 100644 --- a/src/main/resources/application.conf +++ b/src/main/resources/application.conf @@ -1390,6 +1390,11 @@ opencomputers { # Radius the MFU is able to operate in mfuRange: 3 + + # Transposer fluid transfer rate in millibuckets per second + # It may transfer unlimited amount per operation, but will then + # wait ((Amount in buckets)/16) seconds + transposerFluidTransferRate=16000 } # Settings for mod integration (the mod previously known as OpenComponents). diff --git a/src/main/scala/li/cil/oc/Settings.scala b/src/main/scala/li/cil/oc/Settings.scala index 72c06a1d2..ef60188ac 100644 --- a/src/main/scala/li/cil/oc/Settings.scala +++ b/src/main/scala/li/cil/oc/Settings.scala @@ -53,7 +53,7 @@ class Settings(val config: Config) { (-1.0, -1.0) } val enableNanomachinePfx = config.getBoolean("client.enableNanomachinePfx") - + val transposerFluidTransferRate = try { config.getInt("misc.transposerFluidTransferRate") } catch { case _ : Throwable => 16000 } // ----------------------------------------------------------------------- // // computer val threads = config.getInt("computer.threads") max 1 diff --git a/src/main/scala/li/cil/oc/server/component/traits/InventoryTransfer.scala b/src/main/scala/li/cil/oc/server/component/traits/InventoryTransfer.scala index 30cafb313..2ae52b0e4 100644 --- a/src/main/scala/li/cil/oc/server/component/traits/InventoryTransfer.scala +++ b/src/main/scala/li/cil/oc/server/component/traits/InventoryTransfer.scala @@ -1,5 +1,6 @@ package li.cil.oc.server.component.traits +import li.cil.oc.Settings import li.cil.oc.api.machine.Arguments import li.cil.oc.api.machine.Callback import li.cil.oc.api.machine.Context @@ -54,7 +55,7 @@ trait InventoryTransfer extends traits.WorldAware with traits.SideRestricted { result(Unit, reason) case _ => val moved = FluidUtils.transferBetweenFluidHandlersAt(sourcePos, sourceSide.getOpposite, sinkPos, sinkSide.getOpposite, count, sourceTank) - if (moved > 0) context.pause(moved / 1000 * 0.25) // Allow up to 4 buckets per second. + if (moved > 0) context.pause(moved / Settings.get.transposerFluidTransferRate) // Allow up to 16 buckets per second. result(moved > 0, moved) } }