Merge remote-tracking branch 'origin/1.21' into 1.21
@ -128,13 +128,17 @@ fun addItemModels(provider: MatteryItemModelProvider) {
|
||||
provider.generated(MItems.BREAD_MONSTER_SPAWN_EGG, modLocation("item/egg/bread_monster"))
|
||||
provider.generated(MItems.LOADER_SPAWN_EGG, modLocation("item/egg/loader"))
|
||||
|
||||
provider.generatedTiered(MItems.BATTERIES, "battery_tier")
|
||||
provider.capacitorWithGauge(MItems.BATTERY_CRUDE, 10, "battery_gauge_", modLocation("item/battery_tier0"))
|
||||
provider.capacitorWithGauge(MItems.BATTERY_BASIC, 10, "battery_gauge_", modLocation("item/battery_tier1"))
|
||||
provider.capacitorWithGauge(MItems.BATTERY_NORMAL, 10, "battery_gauge_", modLocation("item/battery_tier2"))
|
||||
provider.capacitorWithGauge(MItems.BATTERY_DENSE, 10, "battery_gauge_", modLocation("item/battery_tier3"))
|
||||
provider.capacitorWithGauge(MItems.BATTERY_CAPACITOR, 10, "battery_gauge_", modLocation("item/battery_tier4"))
|
||||
provider.generated(MItems.BATTERY_CREATIVE)
|
||||
provider.generated(MItems.PROCEDURAL_BATTERY, modLocation("item/battery_procedural"))
|
||||
provider.capacitorWithGauge(MItems.PROCEDURAL_BATTERY, 9, "battery_procedural_gauge_", modLocation("item/battery_procedural"))
|
||||
|
||||
provider.generated(MItems.MATTER_CAPACITOR_BASIC, modLocation("item/matter_capacitor_tier1"))
|
||||
provider.generated(MItems.MATTER_CAPACITOR_NORMAL, modLocation("item/matter_capacitor_tier2"))
|
||||
provider.generated(MItems.MATTER_CAPACITOR_DENSE, modLocation("item/matter_capacitor_tier3"))
|
||||
provider.capacitorWithGauge(MItems.MATTER_CAPACITOR_BASIC, 8, "matter_capacitor_gauge_", modLocation("item/matter_capacitor_tier1"))
|
||||
provider.capacitorWithGauge(MItems.MATTER_CAPACITOR_NORMAL, 8, "matter_capacitor_gauge_", modLocation("item/matter_capacitor_tier2"))
|
||||
provider.capacitorWithGauge(MItems.MATTER_CAPACITOR_DENSE, 8, "matter_capacitor_gauge_", modLocation("item/matter_capacitor_tier3"))
|
||||
provider.generated(MItems.MATTER_CAPACITOR_CREATIVE)
|
||||
|
||||
provider.generated(MItems.MachineUpgrades.Basic.BLANK, modLocation("item/machine_upgrade_tier1"))
|
||||
@ -182,8 +186,8 @@ fun addItemModels(provider: MatteryItemModelProvider) {
|
||||
provider.upgrade(MItems.MachineUpgrades.Creative.MATTER_STORAGE_FLAT_SMALL, "matter", "creative")
|
||||
|
||||
|
||||
provider.generated(MItems.QUANTUM_BATTERY)
|
||||
provider.generated(MItems.QUANTUM_CAPACITOR)
|
||||
provider.capacitorWithGauge(MItems.QUANTUM_BATTERY, 10, "battery_gauge_")
|
||||
provider.capacitorWithGauge(MItems.QUANTUM_CAPACITOR, 10, "battery_gauge_")
|
||||
provider.generated(MItems.QUANTUM_BATTERY_CREATIVE)
|
||||
|
||||
provider.generated(MItems.PATTERN_DRIVE_NORMAL, modLocation("item/pattern_drive_tier1"))
|
||||
|
@ -143,6 +143,33 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
|
||||
.texture("layer1", modLocation("item/machine_upgrade_icon_$upgradeType"))
|
||||
}
|
||||
|
||||
fun capacitorWithGauge(item: Item, fillTextures: Int, gaugePrefix: String, baseTexture: ResourceLocation? = null) = exec {
|
||||
val path = item.registryName!!.path
|
||||
val texture = baseTexture ?: modLocation("item/$path")
|
||||
|
||||
val empty = withExistingParent("${path}_empty", GENERATED)
|
||||
.texture("layer0", texture)
|
||||
|
||||
val basic = withExistingParent(path, GENERATED)
|
||||
.texture("layer0", texture)
|
||||
.texture("layer1", modLocation("item/${gaugePrefix}$fillTextures"))
|
||||
.override()
|
||||
.predicate(modLocation("capacitor_gauge"), 0f)
|
||||
.model(empty)
|
||||
.end()
|
||||
|
||||
for (i in 1 .. fillTextures) {
|
||||
val model = withExistingParent("${path}_fill_$i", GENERATED)
|
||||
.texture("layer0", texture)
|
||||
.texture("layer1", modLocation("item/${gaugePrefix}$i"))
|
||||
|
||||
basic.override()
|
||||
.predicate(modLocation("capacitor_gauge"), i.toFloat() / fillTextures.toFloat())
|
||||
.model(model)
|
||||
.end()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
val ARMOR_TRIM_MATERIALS = listOf("quartz", "iron", "netherite", "redstone", "copper", "gold", "emerald", "diamond", "lapis", "amethyst")
|
||||
val GENERATED = ResourceLocation("minecraft", "item/generated")
|
||||
|
@ -29,6 +29,7 @@ import ru.dbotthepony.mc.otm.registry.game.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.util.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.util.countingLazy
|
||||
import ru.dbotthepony.mc.otm.graph.matter.SimpleMatterNode
|
||||
import ru.dbotthepony.mc.otm.util.math.toDecimal
|
||||
import java.util.function.BooleanSupplier
|
||||
|
||||
class MatterBottlerBlockEntity(blockPos: BlockPos, blockState: BlockState) :
|
||||
@ -271,8 +272,8 @@ class MatterBottlerBlockEntity(blockPos: BlockPos, blockState: BlockState) :
|
||||
initialCapacity = initialCapacity ?: it.storedMatter
|
||||
|
||||
hasCapacitors = true
|
||||
val rate = MachinesConfig.MatterBottler.RATE * (1.0 + upgrades.speedBonus)
|
||||
val energyRate = MachinesConfig.MatterBottler.VALUES.energyConsumption * (1.0 + upgrades.speedBonus)
|
||||
val rate = MachinesConfig.MatterBottler.RATE * (Decimal.ONE + upgrades.speedBonus.toDecimal())
|
||||
val energyRate = MachinesConfig.MatterBottler.VALUES.energyConsumption * (Decimal.ONE + upgrades.speedBonus.toDecimal())
|
||||
|
||||
val energyRatio = if (energyRate <= Decimal.ZERO) Decimal.ONE else energy.extractEnergy(energyRate, true) / energyRate
|
||||
val matterExtracted = matter.receiveMatter(it.extractMatterChecked(rate, true), true)
|
||||
|
@ -163,6 +163,13 @@ class MatterDustItem : Item(Properties().stacksTo(64)), IMatterItem {
|
||||
return matter(stack) >= ItemsConfig.MATTER_DUST_CAPACITY
|
||||
}
|
||||
|
||||
fun makeStack(matterValue: Decimal = Decimal.ONE, count: Int = 1): ItemStack {
|
||||
val stack = ItemStack(this, count)
|
||||
matter(stack, matterValue)
|
||||
|
||||
return stack
|
||||
}
|
||||
|
||||
override fun overrideStackedOnOther(
|
||||
pStack: ItemStack,
|
||||
pSlot: Slot,
|
||||
|
@ -36,6 +36,7 @@ import ru.dbotthepony.mc.otm.block.decorative.CargoCrateBlock
|
||||
import ru.dbotthepony.mc.otm.block.decorative.ComputerTerminalBlock
|
||||
import ru.dbotthepony.mc.otm.block.decorative.StarChairBlock
|
||||
import ru.dbotthepony.mc.otm.block.decorative.TritaniumPressurePlate
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
||||
import ru.dbotthepony.mc.otm.capability.matteryEnergy
|
||||
import ru.dbotthepony.mc.otm.client.MatteryGUI
|
||||
import ru.dbotthepony.mc.otm.util.ResourceLocation
|
||||
@ -317,6 +318,21 @@ object MRegistry : IBlockItemRegistryAcceptor {
|
||||
val tag = stack.getOrDefault(MDataComponentTypes.Configurator.CONFIGURATION, CompoundTag())
|
||||
if (tag.isEmpty) 0f else 1f
|
||||
}
|
||||
|
||||
for (item in MItems.MATTER_CAPACITORS) {
|
||||
ItemProperties.register(item, ResourceLocation(OverdriveThatMatters.MOD_ID, "capacitor_gauge")) { stack, _, _, _ ->
|
||||
val cap = stack.getCapability(MatteryCapability.MATTER_ITEM) ?: return@register 1f
|
||||
(cap.storedMatter / cap.maxStoredMatter).toFloat()
|
||||
}
|
||||
}
|
||||
|
||||
for (item in MItems.ALL_BATTERIES) {
|
||||
ItemProperties.register(item, ResourceLocation(OverdriveThatMatters.MOD_ID, "capacitor_gauge")) { stack, _, _, _ ->
|
||||
val energy = stack.matteryEnergy ?: return@register 1f
|
||||
|
||||
(energy.batteryLevel / energy.maxBatteryLevel).toFloat()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ private fun addMainCreativeTabItems(consumer: CreativeModeTab.Output) {
|
||||
|
||||
accept(MItems.GRILL.values)
|
||||
|
||||
// accept(MItems.MATTER_DUST)
|
||||
accept(MItems.MATTER_DUST.makeStack())
|
||||
|
||||
accept(MItems.TRITANIUM_ORE)
|
||||
accept(MItems.DEEPSLATE_TRITANIUM_ORE)
|
||||
|
After Width: | Height: | Size: 368 B |
After Width: | Height: | Size: 376 B |
After Width: | Height: | Size: 372 B |
After Width: | Height: | Size: 377 B |
After Width: | Height: | Size: 374 B |
After Width: | Height: | Size: 374 B |
After Width: | Height: | Size: 374 B |
After Width: | Height: | Size: 374 B |
After Width: | Height: | Size: 377 B |
After Width: | Height: | Size: 373 B |
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 486 B |
After Width: | Height: | Size: 366 B |
After Width: | Height: | Size: 376 B |
After Width: | Height: | Size: 386 B |
After Width: | Height: | Size: 379 B |
After Width: | Height: | Size: 388 B |
After Width: | Height: | Size: 378 B |
After Width: | Height: | Size: 388 B |
After Width: | Height: | Size: 380 B |
After Width: | Height: | Size: 389 B |
Before Width: | Height: | Size: 484 B After Width: | Height: | Size: 471 B |
Before Width: | Height: | Size: 505 B After Width: | Height: | Size: 489 B |
Before Width: | Height: | Size: 505 B After Width: | Height: | Size: 489 B |
Before Width: | Height: | Size: 505 B After Width: | Height: | Size: 489 B |
Before Width: | Height: | Size: 508 B After Width: | Height: | Size: 494 B |
After Width: | Height: | Size: 371 B |
After Width: | Height: | Size: 384 B |
After Width: | Height: | Size: 385 B |
After Width: | Height: | Size: 398 B |
After Width: | Height: | Size: 384 B |
After Width: | Height: | Size: 397 B |
After Width: | Height: | Size: 386 B |
After Width: | Height: | Size: 397 B |
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 466 B |
Before Width: | Height: | Size: 491 B After Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 491 B After Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 491 B After Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 493 B After Width: | Height: | Size: 483 B |
Before Width: | Height: | Size: 494 B After Width: | Height: | Size: 484 B |
Before Width: | Height: | Size: 498 B After Width: | Height: | Size: 488 B |