Skip to content

Commit 68c30d3

Browse files
committed
Improve flap bearing max size config
1 parent b3a51f3 commit 68c30d3

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

common/src/main/kotlin/org/valkyrienskies/clockwork/ClockworkConfig.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ object ClockworkConfig {
172172
@ConfigEntry(description = "The density mult of wanderlite ore in meteors", min = 0.0)
173173
val meteor_density = 0.0
174174

175-
@ConfigEntry(description = "Maximum size of an assembled flap bearing", min = 0.0, max = Int.MAX_VALUE.toDouble())
175+
@ConfigEntry(description = "Maximum amount of blocks a flap bearing can assemble", min = 0.0, max = Int.MAX_VALUE.toDouble())
176176
var flapBearingMaxSize = 16
177+
178+
@ConfigEntry(description = "Maximum amount of blocks a smart flap bearing can assemble", min = 0.0, max = Int.MAX_VALUE.toDouble())
179+
var smartFlapBearingMaxSize = 24
177180
}
178181
}

common/src/main/kotlin/org/valkyrienskies/clockwork/content/contraptions/flap/FlapBearingBlockEntity.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ import net.minecraft.nbt.CompoundTag
1919
import net.minecraft.world.level.block.entity.BlockEntityType
2020
import net.minecraft.world.level.block.state.BlockState
2121
import net.minecraft.world.level.block.state.properties.BlockStateProperties
22+
import org.valkyrienskies.clockwork.ClockworkBlockEntities
2223
import org.valkyrienskies.clockwork.ClockworkConfig
2324
import org.valkyrienskies.clockwork.ClockworkMod
2425
import org.valkyrienskies.clockwork.content.contraptions.flap.contraption.FlapContraption
2526
import org.valkyrienskies.core.impl.shadow.re
2627

27-
open class FlapBearingBlockEntity(type: BlockEntityType<*>?, pos: BlockPos, state: BlockState, val maxSize: Long = ClockworkConfig.SERVER.flapBearingMaxSize.toLong()) :
28+
open class FlapBearingBlockEntity(type: BlockEntityType<*>?, pos: BlockPos, state: BlockState) :
2829
KineticBlockEntity(type, pos, state), IBearingBlockEntity, IDisplayAssemblyExceptions {
2930

3031
var isRunning = false
@@ -136,8 +137,8 @@ open class FlapBearingBlockEntity(type: BlockEntityType<*>?, pos: BlockPos, stat
136137

137138
if (contraption == null) return
138139
if (contraption.blocks.isEmpty()) return
139-
if (contraption.blocks.size > maxSize && maxSize != -1L) {
140-
lastException = AssemblyException("structureTooLarge", maxSize)
140+
if (contraption.blocks.size > getMaxSize() && getMaxSize() != -1) {
141+
lastException = AssemblyException("structureTooLarge", getMaxSize())
141142
return sendData()
142143
}
143144
val anchor = worldPosition.relative(direction)
@@ -240,4 +241,8 @@ open class FlapBearingBlockEntity(type: BlockEntityType<*>?, pos: BlockPos, stat
240241
override fun getLastAssemblyException(): AssemblyException? {
241242
return lastException
242243
}
244+
245+
open fun getMaxSize(): Int {
246+
return ClockworkConfig.SERVER.flapBearingMaxSize
247+
}
243248
}

common/src/main/kotlin/org/valkyrienskies/clockwork/content/contraptions/flap/smart_flap/SmartFlapBearingBlockEntity.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
package org.valkyrienskies.clockwork.content.contraptions.flap.smart_flap
22

3+
import com.simibubi.create.content.contraptions.ControlledContraptionEntity
34
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour
45
import com.simibubi.create.foundation.blockEntity.behaviour.ValueBoxTransform
56
import net.minecraft.core.BlockPos
67
import net.minecraft.core.Direction
78
import net.minecraft.world.level.block.entity.BlockEntityType
89
import net.minecraft.world.level.block.state.BlockState
910
import net.minecraft.world.level.block.state.properties.BlockStateProperties
11+
import org.valkyrienskies.clockwork.ClockworkConfig
1012
import org.valkyrienskies.clockwork.content.contraptions.flap.FlapBearingBlockEntity
1113
import org.valkyrienskies.clockwork.content.contraptions.flap.dual_link.DualLinkBehaviour
1214
import org.valkyrienskies.clockwork.content.contraptions.flap.dual_link.FlapBearingFrequencySlot
1315

14-
class SmartFlapBearingBlockEntity(type: BlockEntityType<*>?, pos: BlockPos, state: BlockState): FlapBearingBlockEntity(type,pos,state,-1L) {
16+
class SmartFlapBearingBlockEntity(type: BlockEntityType<*>?, pos: BlockPos, state: BlockState): FlapBearingBlockEntity(type,pos,state) {
1517

1618
var firstReceivedSignal = 0
1719
var secondReceivedSignal = 0
@@ -54,4 +56,8 @@ class SmartFlapBearingBlockEntity(type: BlockEntityType<*>?, pos: BlockPos, stat
5456
secondReceivedSignal = power
5557
}
5658

59+
override fun getMaxSize(): Int {
60+
return ClockworkConfig.SERVER.smartFlapBearingMaxSize
61+
}
62+
5763
}

0 commit comments

Comments
 (0)