Skip to content

Commit

Permalink
Make fluid transfer speed configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
repo-alt committed Jun 2, 2021
1 parent d972b29 commit 8d35710
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 39 deletions.
39 changes: 3 additions & 36 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"]
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/li/cil/oc/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 8d35710

Please sign in to comment.