Merge remote-tracking branch 'origin/1.21' into 1.21

This commit is contained in:
GearShocky 2025-02-11 19:47:18 +05:00
commit 4c04c6c114
4 changed files with 23 additions and 18 deletions

View File

@ -9,6 +9,7 @@ fun addFlywheelMaterials(provider: FlywheelMaterialDataProvider) {
provider.add(Tags.Blocks.STORAGE_BLOCKS_DIAMOND, Decimal(25_000_000))
provider.add(Tags.Blocks.STORAGE_BLOCKS_COPPER, Decimal(60_000_000))
provider.add(Tags.Blocks.STORAGE_BLOCKS_IRON, Decimal(50_000_000))
provider.add(Tags.Blocks.STORAGE_BLOCKS_GOLD, Decimal(300_000_000))
provider.add(Tags.Blocks.STORAGE_BLOCKS_GOLD, Decimal(300_000_000), momentumLossSpeed = Decimal("0.75"))
provider.add(Tags.Blocks.STORAGE_BLOCKS_NETHERITE, Decimal(1_250_000_000), momentumLossSpeed = Decimal.ONE_HALF)
provider.add(MBlockTags.TRITANIUM_BLOCKS, Decimal(225_000_000))
}

View File

@ -7,9 +7,9 @@ import ru.dbotthepony.mc.otm.core.math.defineDecimal
object CablesConfig : AbstractConfig("cables") {
enum class E(throughput: Decimal) {
CRUDE(Decimal(320)),
REGULAR(Decimal(4096)),
ADVANCED(Decimal(20480)),
CRUDE(Decimal(1024)),
REGULAR(Decimal(8192)),
ADVANCED(Decimal(40960)),
SUPERCONDUCTOR(Decimal.POSITIVE_INFINITY);
init {

View File

@ -33,34 +33,34 @@ open class FlywheelMaterialDataProvider(val modid: String, val location: String?
}
@JvmOverloads
fun add(block: Block, storage: Decimal, priority: Int = 0) {
entries.add(FlywheelMaterials.Entry(block, storage, priority))
fun add(block: Block, storage: Decimal, priority: Int = 0, receiveEfficiency: Decimal = Decimal.ONE, momentumLossSpeed: Decimal = Decimal.ONE) {
entries.add(FlywheelMaterials.Entry(block, storage, priority, receiveEfficiency, momentumLossSpeed))
}
@JvmOverloads
fun add(block: TagKey<Block>, storage: Decimal, priority: Int = 0) {
entries.add(FlywheelMaterials.Entry(block, storage, priority))
fun add(block: TagKey<Block>, storage: Decimal, priority: Int = 0, receiveEfficiency: Decimal = Decimal.ONE, momentumLossSpeed: Decimal = Decimal.ONE) {
entries.add(FlywheelMaterials.Entry(block, storage, priority, receiveEfficiency, momentumLossSpeed))
}
@JvmName("addBlocks")
@JvmOverloads
fun add(blocks: Collection<Block>, storage: Decimal, priority: Int = 0) {
fun add(blocks: Collection<Block>, storage: Decimal, priority: Int = 0, receiveEfficiency: Decimal = Decimal.ONE, momentumLossSpeed: Decimal = Decimal.ONE) {
for (block in blocks)
entries.add(FlywheelMaterials.Entry(block, storage, priority))
entries.add(FlywheelMaterials.Entry(block, storage, priority, receiveEfficiency, momentumLossSpeed))
}
@JvmName("addBlocks")
@JvmOverloads
fun add(blocks: Array<out Block>, storage: Decimal, priority: Int = 0) {
fun add(blocks: Array<out Block>, storage: Decimal, priority: Int = 0, receiveEfficiency: Decimal = Decimal.ONE, momentumLossSpeed: Decimal = Decimal.ONE) {
for (block in blocks)
entries.add(FlywheelMaterials.Entry(block, storage, priority))
entries.add(FlywheelMaterials.Entry(block, storage, priority, receiveEfficiency, momentumLossSpeed))
}
@JvmName("addTags")
@JvmOverloads
fun add(blocks: Array<out TagKey<Block>>, storage: Decimal, priority: Int = 0) {
fun add(blocks: Array<out TagKey<Block>>, storage: Decimal, priority: Int = 0, receiveEfficiency: Decimal = Decimal.ONE, momentumLossSpeed: Decimal = Decimal.ONE) {
for (block in blocks)
entries.add(FlywheelMaterials.Entry(block, storage, priority))
entries.add(FlywheelMaterials.Entry(block, storage, priority, receiveEfficiency, momentumLossSpeed))
}
@JvmName("addBlocks")
@ -83,6 +83,10 @@ open class FlywheelMaterialDataProvider(val modid: String, val location: String?
return add(blocks, storage, priority)
}
fun add(entry: FlywheelMaterials.Entry) {
entries.add(entry)
}
override fun run(output: CachedOutput): CompletableFuture<*> {
if (location == null) {
val futures = ArrayList<CompletableFuture<*>>()

View File

@ -55,8 +55,8 @@ object FlywheelMaterials : SimpleJsonResourceReloadListener(GsonBuilder().setPre
val receiveEfficiency: Decimal = Decimal.ONE,
val momentumLossSpeed: Decimal = Decimal.ONE
) : Comparable<Entry> {
constructor(id: Block, storage: Decimal, priority: Int = 0, windUpEfficiency: Decimal = Decimal.ONE, windDownEfficiency: Decimal = Decimal.ONE) : this(Either.right(id), storage, priority, windUpEfficiency, windDownEfficiency)
constructor(id: TagKey<Block>, storage: Decimal, priority: Int = 0, windUpEfficiency: Decimal = Decimal.ONE, windDownEfficiency: Decimal = Decimal.ONE) : this(Either.left(id), storage, priority, windUpEfficiency, windDownEfficiency)
constructor(id: Block, storage: Decimal, priority: Int = 0, receiveEfficiency: Decimal = Decimal.ONE, momentumLossSpeed: Decimal = Decimal.ONE) : this(Either.right(id), storage, priority, receiveEfficiency, momentumLossSpeed)
constructor(id: TagKey<Block>, storage: Decimal, priority: Int = 0, receiveEfficiency: Decimal = Decimal.ONE, momentumLossSpeed: Decimal = Decimal.ONE) : this(Either.left(id), storage, priority, receiveEfficiency, momentumLossSpeed)
override fun compareTo(other: Entry): Int {
val selfLeft = id.left().isPresent
@ -248,11 +248,11 @@ object FlywheelMaterials : SimpleJsonResourceReloadListener(GsonBuilder().setPre
event.toolTip.add(TranslatableComponent("otm.gui.flywheel.storage", entry.storage.formatPower()).withStyle(ChatFormatting.GRAY))
if (entry.receiveEfficiency != Decimal.ONE) {
event.toolTip.add(TranslatableComponent("otm.gui.flywheel.receive_efficiency", entry.receiveEfficiency.toString(1)).withStyle(ChatFormatting.GRAY))
event.toolTip.add(TranslatableComponent("otm.gui.flywheel.receive_efficiency", entry.receiveEfficiency.toString(2)).withStyle(ChatFormatting.GRAY))
}
if (entry.momentumLossSpeed != Decimal.ONE) {
event.toolTip.add(TranslatableComponent("otm.gui.flywheel.momentum_loss_speed", entry.momentumLossSpeed.toString(1)).withStyle(ChatFormatting.GRAY))
event.toolTip.add(TranslatableComponent("otm.gui.flywheel.momentum_loss_speed", entry.momentumLossSpeed.toString(2)).withStyle(ChatFormatting.GRAY))
}
}
}