Skip to content

Commit 5c3e783

Browse files
Fix copter bearing
1 parent 879a2c8 commit 5c3e783

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

common/src/main/kotlin/org/valkyrienskies/clockwork/content/contraptions/propeller/PropellerBearingBlockEntity.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ open class PropellerBearingBlockEntity(type: BlockEntityType<*>, pos: BlockPos,
228228
active = !overStressed && !stalled
229229
updateSpinDir(currentOmega < 0)
230230
val lastTargetOmega = targetOmega
231-
targetOmega = convertToAngular(this.getSpeed()).toDouble() * (if (isInverted()) -1.0 else 1.0) * 8.0
231+
targetOmega = convertToAngular(this.getSpeed()).toDouble() * (if (isInverted()) -1.0 else 1.0)
232232

233233
if (lastTargetOmega != targetOmega) {
234234
sendData()
235235
}
236-
currentOmega += Mth.clamp((targetOmega - currentOmega) / 10.0 / (if (starting) (targetOmega.absoluteValue + 1.0 - min(startingProgress.toDouble(), targetOmega.absoluteValue)) else 1.0), convertToAngular(-32f).toDouble(), convertToAngular(32f).toDouble())
236+
currentOmega += Mth.clamp((targetOmega - currentOmega) / 2.0 / (if (starting) (targetOmega.absoluteValue + 1.0 - min(startingProgress.toDouble(), targetOmega.absoluteValue)) else 1.0), convertToAngular(-32f).toDouble(), convertToAngular(32f).toDouble())
237237
} else {
238238
active = false
239239
disassemblyProgress--
@@ -347,7 +347,7 @@ open class PropellerBearingBlockEntity(type: BlockEntityType<*>, pos: BlockPos,
347347
angle = 0.0
348348
currentOmega = 0.0
349349

350-
targetOmega = convertToAngular(this.getSpeed()).toDouble() * (if (isInverted()) -1.0 else 1.0) * 8.0
350+
targetOmega = convertToAngular(this.getSpeed()).toDouble() * (if (isInverted()) -1.0 else 1.0)
351351

352352
getBlades()
353353
if (brass && blades.isEmpty()) {

common/src/main/kotlin/org/valkyrienskies/clockwork/content/contraptions/propeller/copter/CopterBearingBlockEntity.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ class CopterBearingBlockEntity(type: BlockEntityType<*>, pos: BlockPos, state: B
327327
}
328328

329329
override fun applyPowerEffect() {
330+
if (powerOne == 0 && powerTwo == 0) return
330331
val (axisOne, axisTwo) = getPowerDirections()
331332
val positiveNormalOne = Direction.get(POSITIVE, axisOne).normal.toJOMLD()
332333
val positiveNormalTwo = Direction.get(POSITIVE, axisTwo).normal.toJOMLD()
@@ -346,7 +347,7 @@ class CopterBearingBlockEntity(type: BlockEntityType<*>, pos: BlockPos, state: B
346347
return 1f
347348
}
348349
val facing = blockState.getValue(BlockStateProperties.FACING)
349-
speed = convertToDirection(speed, facing)
350+
speed = -convertToDirection(speed, facing)
350351
if (rotationDirection.value == 1) {
351352
speed *= -1f
352353
}

common/src/main/kotlin/org/valkyrienskies/clockwork/content/forces/PropellerController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ class PropellerController(
289289
val bladeWidth = if (blade.wide) 0.375 else 0.25
290290
// TODO: multiply internal RPM of propeller by 8.0
291291
// bearingSpeed is in deg/t, convert to rev/s
292-
val bladeRotationalSpeed = abs(physProp.bearingSpeed/360.0*20.0)// * 8.0 // Unit in rev/s
292+
val bladeRotationalSpeed = abs(physProp.bearingSpeed/360.0*20.0) * 8.0 // Unit in rev/s
293293

294294
val power = calculateBladePower(velocityTowardsPropellerDir,
295295
bladeRotationalSpeed, blade.length, blade.angle, bladeWidth)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"handler": "valkyrienskies:shipyard"
3+
}

0 commit comments

Comments
 (0)