matter capacitor gauge

This commit is contained in:
YuRaNnNzZZ 2025-04-04 15:07:42 +03:00
parent 167ea42ec8
commit 55856e6aec
Signed by: YuRaNnNzZZ
GPG Key ID: 5F71738C85A6006D
16 changed files with 38 additions and 3 deletions

View File

@ -132,9 +132,9 @@ fun addItemModels(provider: MatteryItemModelProvider) {
provider.generated(MItems.BATTERY_CREATIVE)
provider.generated(MItems.PROCEDURAL_BATTERY, 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, baseTexture = modLocation("item/matter_capacitor_tier1"))
provider.capacitorWithGauge(MItems.MATTER_CAPACITOR_NORMAL, baseTexture = modLocation("item/matter_capacitor_tier2"))
provider.capacitorWithGauge(MItems.MATTER_CAPACITOR_DENSE, baseTexture = modLocation("item/matter_capacitor_tier3"))
provider.generated(MItems.MATTER_CAPACITOR_CREATIVE)
provider.generated(MItems.MachineUpgrades.Basic.BLANK, modLocation("item/machine_upgrade_tier1"))

View File

@ -143,6 +143,33 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
.texture("layer1", modLocation("item/machine_upgrade_icon_$upgradeType"))
}
fun capacitorWithGauge(item: Item, fillTextures: Int = 8, baseTexture: ResourceLocation?) = 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/matter_capacitor_gauge_$fillTextures"))
.override()
.predicate(modLocation("matter_capacitor_fill"), 0f)
.model(empty)
.end()
for (i in 1 .. fillTextures) {
val model = withExistingParent("${path}_fill_$i", GENERATED)
.texture("layer0", texture)
.texture("layer1", modLocation("item/matter_capacitor_gauge_$i"))
basic.override()
.predicate(modLocation("matter_capacitor_fill"), 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")

View File

@ -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,13 @@ 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, "matter_capacitor_fill")) { stack, _, _, _ ->
val cap = stack.getCapability(MatteryCapability.MATTER_ITEM) ?: return@register 1f
(cap.storedMatter / cap.maxStoredMatter).toFloat()
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 491 B

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 491 B

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 491 B

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 493 B

After

Width:  |  Height:  |  Size: 483 B