Merge branch '1.19.4' of https://git.dbotthepony.ru/DBot/overdrive_that_matters into 1.19.3
This commit is contained in:
commit
46bc642385
@ -555,6 +555,9 @@ object DataGen {
|
||||
addChestLootTables(lootTableProvider)
|
||||
|
||||
recipeProvider.exec { _, consumer ->
|
||||
addToolsRecipes(consumer)
|
||||
addComponentRecipes(consumer)
|
||||
addStorageItemRecipes(consumer)
|
||||
addCraftingTableRecipes(consumer)
|
||||
addBlastingRecipes(consumer)
|
||||
addDecorativesRecipes(recipeProvider, consumer)
|
||||
|
@ -90,7 +90,7 @@ fun addMachineAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
|
||||
val press = AdvancementBuilder()
|
||||
.parent(chem)
|
||||
.display(
|
||||
itemStack = ItemStack(MItems.PLATE_PRESS[null]!!),
|
||||
itemStack = ItemStack(MItems.TWIN_PLATE_PRESS[null]!!),
|
||||
title = translation.add("plate_press", "Bending the Material") {
|
||||
russian("Раскатка металла")
|
||||
},
|
||||
@ -99,15 +99,12 @@ fun addMachineAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
|
||||
},
|
||||
)
|
||||
.also {
|
||||
for ((i, m) in MItems.PLATE_PRESS.values.withIndex())
|
||||
for ((i, m) in MItems.TWIN_PLATE_PRESS.values.withIndex())
|
||||
it.addCriterion(i.toString(), criterion(m))
|
||||
}
|
||||
.requirements(RequirementsStrategy.OR)
|
||||
.save(serializer, modLocation("machines/plate_press"))
|
||||
|
||||
CraftEntry(MItems.TWIN_PLATE_PRESS.values, "Twice the Thud",
|
||||
russianName = "Двойной стук").make(serializer, press, translation)
|
||||
|
||||
CraftEntry(MItems.ENERGY_SERVO.values, "Power Goes In, Powered Things Go Out",
|
||||
russianName = "Энергия на вход, электроинструмент на выход").make(serializer, press, translation)
|
||||
|
||||
|
@ -119,6 +119,25 @@ private fun sounds(provider: MatteryLanguageProvider) {
|
||||
|
||||
private fun misc(provider: MatteryLanguageProvider) {
|
||||
with(provider.english) {
|
||||
gui("double_processing", "Processes two items at once")
|
||||
|
||||
misc("painted.black", "Painted Black")
|
||||
misc("painted.blue", "Painted Blue")
|
||||
misc("painted.brown", "Painted Brown")
|
||||
misc("painted.cyan", "Painted Cyan")
|
||||
misc("painted.gray", "Painted Gray")
|
||||
misc("painted.green", "Painted Green")
|
||||
misc("painted.light_blue", "Painted Light Blue")
|
||||
misc("painted.light_gray", "Painted Light Gray")
|
||||
misc("painted.lime", "Painted Lime")
|
||||
misc("painted.magenta", "Painted Magenta")
|
||||
misc("painted.orange", "Painted Orange")
|
||||
misc("painted.pink", "Painted Pink")
|
||||
misc("painted.purple", "Painted Purple")
|
||||
misc("painted.red", "Painted Red")
|
||||
misc("painted.white", "Painted White")
|
||||
misc("painted.yellow", "Painted Yellow")
|
||||
|
||||
gui("shift_for_more_info", "<Hold SHIFT for more info>")
|
||||
|
||||
gui("help.slot_filters", "Hold CTRL to setup slot filters")
|
||||
@ -279,7 +298,6 @@ private fun misc(provider: MatteryLanguageProvider) {
|
||||
misc("item.power.storage0", "Stored energy: %s")
|
||||
misc("item.power.throughput", "Max I/O: %s / %s")
|
||||
misc("item.power.throughput_mono", "Max I/O: %s")
|
||||
misc("item.power.infinity", "∞ MtJ")
|
||||
|
||||
misc("item.worker.work_ticks_mono", "Work ticks: %s")
|
||||
misc("item.worker.work_ticks", "Work ticks: %s / %s")
|
||||
@ -293,9 +311,8 @@ private fun misc(provider: MatteryLanguageProvider) {
|
||||
misc("item.pattern.research.item_count", "Items: %s / %s")
|
||||
misc("item.pattern.research.advance", "Progress per item: %s%%")
|
||||
|
||||
|
||||
misc("item.matter.infinite", "Stored matter: ∞ / ∞")
|
||||
misc("item.matter.normal", "Stored matter: %s / %s")
|
||||
misc("item.matter.storage", "Stored matter: %s / %s")
|
||||
misc("item.matter.storage0", "Stored matter: %s")
|
||||
|
||||
misc("gui.matter_task.total", "Total: %s")
|
||||
misc("gui.matter_task.required", "Left to be done: %s")
|
||||
@ -417,29 +434,59 @@ private fun death(provider: MatteryLanguageProvider) {
|
||||
private fun blocks(provider: MatteryLanguageProvider) {
|
||||
with(provider.english) {
|
||||
addBlock(MBlocks.ANDROID_STATION.values, "Android Station")
|
||||
addBlock(MBlocks.ANDROID_STATION.values, "desc", "Grants access to android upgrades")
|
||||
|
||||
addBlock(MBlocks.ANDROID_CHARGER.values, "Wireless Charger")
|
||||
addBlock(MBlocks.ANDROID_CHARGER.values, "desc", "Charges nearby androids and exopacks")
|
||||
|
||||
addBlock(MBlocks.BATTERY_BANK.values, "Battery Bank")
|
||||
addBlock(MBlocks.BATTERY_BANK.values, "desc", "Provides a way to use battery items as ordinary energy storage cell")
|
||||
|
||||
addBlock(MBlocks.MATTER_DECOMPOSER.values, "Matter Decomposer")
|
||||
addBlock(MBlocks.MATTER_DECOMPOSER.values, "desc", "Breaks down items into pure matter")
|
||||
|
||||
addBlock(MBlocks.MATTER_CAPACITOR_BANK.values, "Matter Capacitor Bank")
|
||||
addBlock(MBlocks.MATTER_CAPACITOR_BANK.values, "desc", "Provides matter storage for system when matter capacitors are attached to it")
|
||||
|
||||
add(MBlocks.MATTER_CABLE, "Matter Network Cable")
|
||||
|
||||
add(MBlocks.PATTERN_STORAGE, "Pattern Storage")
|
||||
add(MBlocks.PATTERN_STORAGE, "desc", "Stores Patterns for system usage")
|
||||
|
||||
addBlock(MBlocks.MATTER_SCANNER.values, "Matter Scanner")
|
||||
addBlock(MBlocks.MATTER_SCANNER.values, "desc", "Scans items into Patterns for future replication")
|
||||
|
||||
addBlock(MBlocks.MATTER_PANEL.values, "Pattern Monitor")
|
||||
addBlock(MBlocks.MATTER_PANEL.values, "desc", "Allows to dispatch replication tasks")
|
||||
|
||||
addBlock(MBlocks.MATTER_REPLICATOR.values, "Matter Replicator")
|
||||
addBlock(MBlocks.MATTER_REPLICATOR.values, "desc", "Executes replication tasks")
|
||||
|
||||
addBlock(MBlocks.MATTER_BOTTLER.values, "Matter Bottler")
|
||||
addBlock(MBlocks.DRIVE_VIEWER.values, "Drive Viewer")
|
||||
add(MBlocks.BLACK_HOLE, "Local Anomalous Spacetime Dilation Singular Point")
|
||||
addBlock(MBlocks.COBBLESTONE_GENERATOR.values, "Cobblestone Generator")
|
||||
add(MBlocks.INFINITE_WATER_SOURCE, "Infinite Water Source")
|
||||
addBlock(MBlocks.MATTER_BOTTLER.values, "desc", "Exchanges matter between matter holding items")
|
||||
|
||||
addBlock(MBlocks.ESSENCE_STORAGE.values, "Essence Storage")
|
||||
addBlock(MBlocks.ESSENCE_STORAGE.values, "desc", "Allows to store and retrieve experience levels")
|
||||
|
||||
addBlock(MBlocks.MATTER_RECONSTRUCTOR.values, "Matter Reconstructor")
|
||||
addBlock(MBlocks.MATTER_RECONSTRUCTOR.values, "desc", "Repairs tools using matter")
|
||||
|
||||
addBlock(MBlocks.MATTER_RECYCLER.values, "Matter Recycler")
|
||||
addBlock(MBlocks.MATTER_RECYCLER.values, "desc", "Refines matter dust back into pure matter")
|
||||
|
||||
add(MBlocks.MATTER_ENTANGLER, "Matter Entangler")
|
||||
|
||||
addBlock(MBlocks.DRIVE_VIEWER.values, "Drive Viewer")
|
||||
|
||||
add(MBlocks.BLACK_HOLE, "Local Anomalous Spacetime Dilation Singular Point")
|
||||
|
||||
addBlock(MBlocks.COBBLESTONE_GENERATOR.values, "Cobblestone Generator")
|
||||
add(MBlocks.INFINITE_WATER_SOURCE, "Infinite Water Source")
|
||||
add(MBlocks.INFINITE_WATER_SOURCE, "desc", "Pushes water into all neighbour blocks")
|
||||
|
||||
add(MBlocks.DEV_CHEST, "Dev Chest")
|
||||
add(MBlocks.DEV_CHEST, "desc", "Contains all items present in game")
|
||||
add(MBlocks.PAINTER, "Painting Table")
|
||||
add(MBlocks.MATTER_ENTANGLER, "Matter Entangler")
|
||||
|
||||
add(MBlocks.LIQUID_XP, "Liquid XP")
|
||||
add(MItems.LIQUID_XP_BUCKET, "Liquid XP Bucket")
|
||||
@ -449,26 +496,37 @@ private fun blocks(provider: MatteryLanguageProvider) {
|
||||
|
||||
add(MBlocks.ENGINE, "Ship Engine")
|
||||
add(MBlocks.ENGINE, "desc", "Unfortunately, it doesn't seem to be functional anymore.")
|
||||
|
||||
add(MBlocks.HOLO_SIGN, "Holo Sign")
|
||||
add(MBlocks.HOLO_SIGN, "desc", "Multi-line, colored and glowing, text sign")
|
||||
|
||||
add(MBlocks.TRITANIUM_INGOT_BLOCK, "Tritanium Plating Block")
|
||||
|
||||
addBlock(MBlocks.ENERGY_COUNTER.values, "Energy Counter")
|
||||
addBlock(MBlocks.ENERGY_COUNTER.values, "desc", "Restricts energy flow;")
|
||||
addBlock(MBlocks.ENERGY_COUNTER.values, "desc2", "Allows to limit energy throughput;")
|
||||
addBlock(MBlocks.ENERGY_COUNTER.values, "desc3", "Collects statistics of passed energy;")
|
||||
addBlock(MBlocks.ENERGY_COUNTER.values, "desc4", "Displays flow activity on its monitor")
|
||||
|
||||
add(MBlocks.ENERGY_COUNTER[null]!!, "facing", "Input facing: %s")
|
||||
add(MBlocks.ENERGY_COUNTER[null]!!, "switch", "Switch input facing")
|
||||
add(MBlocks.ENERGY_COUNTER[null]!!, "limit", "I/O Limit. -1 means no limit")
|
||||
|
||||
addBlock(MBlocks.CHEMICAL_GENERATOR.values, "Chemical Generator")
|
||||
addBlock(MBlocks.CHEMICAL_GENERATOR.values, "desc", "Generates power by burning solid fuels")
|
||||
|
||||
add(MBlocks.DRIVE_RACK, "Condensation Drive Rack")
|
||||
addBlock(MBlocks.ITEM_MONITOR.values, "Item Monitor")
|
||||
addBlock(MBlocks.PLATE_PRESS.values, "Plate Press")
|
||||
addBlock(MBlocks.TWIN_PLATE_PRESS.values, "Twin Plate Press")
|
||||
|
||||
addBlock(MBlocks.POWERED_FURNACE.values, "Electric Furnace")
|
||||
addBlock(MBlocks.POWERED_FURNACE.values, "desc", "Allows to smelt items using energy")
|
||||
addBlock(MBlocks.POWERED_SMOKER.values, "Microwave Oven")
|
||||
addBlock(MBlocks.POWERED_SMOKER.values, "desc", "Allows to process smoker recipes using energy")
|
||||
addBlock(MBlocks.POWERED_BLAST_FURNACE.values, "Induction Furnace")
|
||||
addBlock(MBlocks.POWERED_BLAST_FURNACE.values, "desc", "Allows to process blasting recipes using energy")
|
||||
|
||||
addBlock(MBlocks.MATTER_RECYCLER.values, "Matter Recycler")
|
||||
addBlock(MBlocks.ENERGY_SERVO.values, "Energy Servo")
|
||||
addBlock(MBlocks.ENERGY_SERVO.values, "desc", "Charges, Discharges or Exchanges energy of items")
|
||||
|
||||
@ -530,7 +588,7 @@ private fun items(provider: MatteryLanguageProvider) {
|
||||
add(MItems.EXPLOSIVE_HAMMER, "desc", "For those who feel bored")
|
||||
add(MItems.EXPLOSIVE_HAMMER, "primed", "Primed!")
|
||||
add(MItems.EXPLOSIVE_HAMMER, "not_primed0", "Not primed")
|
||||
add(MItems.EXPLOSIVE_HAMMER, "not_primed1", "Prime at crafting table with little of gunpowder and nugget payload")
|
||||
add(MItems.EXPLOSIVE_HAMMER, "not_primed1", "Prime with little of gunpowder and iron nugget payload in your inventory by holding RMB")
|
||||
|
||||
add(MItems.EXOPACK_PROBE, "Exopack Probe")
|
||||
add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_CREATIVE, "Creative Exopack Inventory Upgrade")
|
||||
|
@ -1,5 +1,6 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.lang
|
||||
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import ru.dbotthepony.mc.otm.registry.AndroidFeatures
|
||||
import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||
import ru.dbotthepony.mc.otm.registry.MEntityTypes
|
||||
@ -127,6 +128,25 @@ private fun sounds(provider: MatteryLanguageProvider) {
|
||||
|
||||
private fun misc(provider: MatteryLanguageProvider) {
|
||||
with(provider.russian) {
|
||||
gui("double_processing", "Обрабатывает два предмета одновременно")
|
||||
|
||||
misc("painted.black", "Окрашено в чёрный")
|
||||
misc("painted.blue", "Окрашено в синий")
|
||||
misc("painted.brown", "Окрашено в коричневый")
|
||||
misc("painted.cyan", "Окрашено в бирюзовый")
|
||||
misc("painted.gray", "Окрашено в серый")
|
||||
misc("painted.green", "Окрашено в зелёный")
|
||||
misc("painted.light_blue", "Окрашено в светло-синий")
|
||||
misc("painted.light_gray", "Окрашено в светло-серый")
|
||||
misc("painted.lime", "Окрашено в лаймовый")
|
||||
misc("painted.magenta", "Окрашено в сиреневый")
|
||||
misc("painted.orange", "Окрашено в оранжевый")
|
||||
misc("painted.pink", "Окрашено в розовый")
|
||||
misc("painted.purple", "Окрашено в фиолетовый")
|
||||
misc("painted.red", "Окрашено в красный")
|
||||
misc("painted.white", "Окрашено в белый")
|
||||
misc("painted.yellow", "Окрашено в жёлтый")
|
||||
|
||||
gui("shift_for_more_info", "<Удерживайте SHIFT для подробностей>")
|
||||
|
||||
gui("help.slot_filters", "Удерживайте CTRL для настройки фильтрации слотов")
|
||||
@ -283,9 +303,9 @@ private fun misc(provider: MatteryLanguageProvider) {
|
||||
gui("power.last_tick", "Последний тик:")
|
||||
|
||||
misc("item.power.storage", "Хранимая энергия: %s / %s")
|
||||
misc("item.power.storage0", "Хранимая энергия: %s")
|
||||
misc("item.power.throughput", "Максимальная пропускная способность: %s / %s")
|
||||
misc("item.power.throughput_mono", "Максимальная пропускная способность: %s")
|
||||
misc("item.power.infinity", "∞ МтДж")
|
||||
|
||||
misc("item.worker.work_ticks_mono", "Рабочих тиков: %s")
|
||||
misc("item.worker.work_ticks", "Рабочих тиков: %s / %s")
|
||||
@ -298,8 +318,8 @@ private fun misc(provider: MatteryLanguageProvider) {
|
||||
misc("item.pattern.research.item_count", "Предметы: %s / %s")
|
||||
misc("item.pattern.research.advance", "Исследование за предмет: %s%%")
|
||||
|
||||
misc("item.matter.infinite", "Хранимая материя неиссякаема")
|
||||
misc("item.matter.normal", "Хранимая материя: %s / %s")
|
||||
misc("item.matter.storage", "Хранимая материя: %s / %s")
|
||||
misc("item.matter.storage0", "Хранимая материя: %s")
|
||||
|
||||
misc("gui.matter_task.total", "Всего: %s")
|
||||
misc("gui.matter_task.required", "Осталось исполнить: %s")
|
||||
@ -419,29 +439,58 @@ private fun death(provider: MatteryLanguageProvider) {
|
||||
private fun blocks(provider: MatteryLanguageProvider) {
|
||||
with(provider.russian) {
|
||||
addBlock(MBlocks.ANDROID_STATION.values, "Станция андроидов")
|
||||
addBlock(MBlocks.ANDROID_STATION.values, "desc", "Даёт доступ к улучшениям андроида")
|
||||
|
||||
addBlock(MBlocks.ANDROID_CHARGER.values, "Беспроводной зарядник")
|
||||
addBlock(MBlocks.ANDROID_CHARGER.values, "desc", "Заряжает ближайших андроидов и экзопаки")
|
||||
|
||||
addBlock(MBlocks.BATTERY_BANK.values, "Банк аккумуляторов")
|
||||
addBlock(MBlocks.BATTERY_BANK.values, "desc", "Позволяет использовать аккумуляторы как обычное хранилище энергии")
|
||||
|
||||
addBlock(MBlocks.MATTER_DECOMPOSER.values, "Декомпозитор материи")
|
||||
addBlock(MBlocks.MATTER_DECOMPOSER.values, "desc", "Разбивает предметы в чистую материю")
|
||||
|
||||
addBlock(MBlocks.MATTER_CAPACITOR_BANK.values, "Банк накопителей материи")
|
||||
addBlock(MBlocks.MATTER_CAPACITOR_BANK.values, "desc", "Является хранилищем материи для системы в связке с накопителями материи")
|
||||
|
||||
add(MBlocks.MATTER_CABLE, "Кабель сети материи")
|
||||
|
||||
add(MBlocks.PATTERN_STORAGE, "Хранилище шаблонов")
|
||||
add(MBlocks.PATTERN_STORAGE, "desc", "Хранит шаблоны предметов для пользования сетью")
|
||||
|
||||
addBlock(MBlocks.MATTER_SCANNER.values, "Сканер материи")
|
||||
addBlock(MBlocks.MATTER_SCANNER.values, "desc", "Сканирует предметы в шаблоны для будущей репликации")
|
||||
|
||||
addBlock(MBlocks.MATTER_PANEL.values, "Монитор шаблонов")
|
||||
addBlock(MBlocks.MATTER_PANEL.values, "desc", "Позволяет создавать задачи репликации")
|
||||
|
||||
addBlock(MBlocks.MATTER_REPLICATOR.values, "Репликатор материи")
|
||||
addBlock(MBlocks.MATTER_REPLICATOR.values, "desc", "Исполняет задачи репликации")
|
||||
|
||||
addBlock(MBlocks.MATTER_BOTTLER.values, "Бутилировщик материи")
|
||||
addBlock(MBlocks.DRIVE_VIEWER.values, "Просмотрщик дисков конденсации")
|
||||
add(MBlocks.BLACK_HOLE, "Локализированная сингулярная точка аномального искажения пространства-времени")
|
||||
addBlock(MBlocks.COBBLESTONE_GENERATOR.values, "Генератор булыжника")
|
||||
add(MBlocks.INFINITE_WATER_SOURCE, "Неиссякаемый источник воды")
|
||||
addBlock(MBlocks.MATTER_BOTTLER.values, "desc", "Позволяет переливать материю между предметами, хранящими материю")
|
||||
|
||||
addBlock(MBlocks.ESSENCE_STORAGE.values, "Хранилище эссенции")
|
||||
addBlock(MBlocks.ESSENCE_STORAGE.values, "desc", "Позволяет хранить очки опыта")
|
||||
|
||||
addBlock(MBlocks.MATTER_RECONSTRUCTOR.values, "Материальный реконструктор")
|
||||
addBlock(MBlocks.MATTER_RECONSTRUCTOR.values, "desc", "Чинит инструменты используя материю")
|
||||
|
||||
addBlock(MBlocks.MATTER_RECYCLER.values, "Перерабатыватель материи")
|
||||
addBlock(MBlocks.MATTER_RECYCLER.values, "desc", "Перерабатывает материальную пыль обратно в чистую материю")
|
||||
|
||||
add(MBlocks.MATTER_ENTANGLER, "Квантовый запутыватель материи")
|
||||
|
||||
addBlock(MBlocks.COBBLESTONE_GENERATOR.values, "Генератор булыжника")
|
||||
add(MBlocks.INFINITE_WATER_SOURCE, "Неиссякаемый источник воды")
|
||||
add(MBlocks.INFINITE_WATER_SOURCE, "desc", "Выталкивает воду в соседние блоки автоматически")
|
||||
add(MBlocks.BLACK_HOLE, "Локализированная сингулярная точка аномального искажения пространства-времени")
|
||||
|
||||
add(MBlocks.DEV_CHEST, "Сундук разработчика")
|
||||
add(MBlocks.DEV_CHEST, "desc", "Хранит все предметы, которые есть в игре")
|
||||
add(MBlocks.PAINTER, "Стол маляра")
|
||||
add(MBlocks.MATTER_ENTANGLER, "Квантовый запутыватель материи")
|
||||
|
||||
addBlock(MBlocks.DRIVE_VIEWER.values, "Просмотрщик дисков конденсации")
|
||||
|
||||
add(MBlocks.LIQUID_XP, "Жидкий опыт")
|
||||
add(MItems.LIQUID_XP_BUCKET, "Ведро жидкого опыта")
|
||||
@ -450,27 +499,38 @@ private fun blocks(provider: MatteryLanguageProvider) {
|
||||
add(MBlocks.FLUID_TANK, "named", "Жидкостный бак (%s)")
|
||||
|
||||
add(MBlocks.ENGINE, "Двигатель корабля")
|
||||
add(MBlocks.ENGINE, "desc", "К сожалению, он больше не выглядит рабочим.")
|
||||
add(MBlocks.ENGINE, "desc", "К сожалению, он более не функционирует")
|
||||
|
||||
add(MBlocks.HOLO_SIGN, "Голографическая табличка")
|
||||
add(MBlocks.HOLO_SIGN, "desc", "Многострочная, крашеная и светящееся, табличка")
|
||||
|
||||
add(MBlocks.TRITANIUM_INGOT_BLOCK, "Блок слитков тритана")
|
||||
|
||||
addBlock(MBlocks.ENERGY_COUNTER.values, "Счётчик энергии")
|
||||
addBlock(MBlocks.ENERGY_COUNTER.values, "desc", "Ограничивает направление передачи энергии;")
|
||||
addBlock(MBlocks.ENERGY_COUNTER.values, "desc2", "Позволяет ограничивать максимальную пропускную способность;")
|
||||
addBlock(MBlocks.ENERGY_COUNTER.values, "desc3", "Собирает статистику о переданной через себя энергии;")
|
||||
addBlock(MBlocks.ENERGY_COUNTER.values, "desc4", "Отображает текущую активность передачи энергии на своём экране")
|
||||
|
||||
add(MBlocks.ENERGY_COUNTER[null]!!, "Facing", "сторона входа: %s")
|
||||
add(MBlocks.ENERGY_COUNTER[null]!!, "Switch", "сменить сторону входа")
|
||||
add(MBlocks.ENERGY_COUNTER[null]!!, "Limit", "лимит ввода/вывода. -1 для отключения лимитов")
|
||||
|
||||
addBlock(MBlocks.CHEMICAL_GENERATOR.values, "Химический генератор")
|
||||
addBlock(MBlocks.CHEMICAL_GENERATOR.values, "desc", "Генерирует энергию сжигая твёрдое топливо")
|
||||
|
||||
add(MBlocks.DRIVE_RACK, "Стеллаж дисков конденсации")
|
||||
addBlock(MBlocks.ITEM_MONITOR.values, "Монитор предметов")
|
||||
addBlock(MBlocks.PLATE_PRESS.values, "Пресс пластин")
|
||||
addBlock(MBlocks.TWIN_PLATE_PRESS.values, "Двойной пресс пластин")
|
||||
|
||||
addBlock(MBlocks.POWERED_FURNACE.values, "Электрическая печь")
|
||||
addBlock(MBlocks.POWERED_FURNACE.values, "desc", "Позволяет обрабатывать рецепты печи используя энергию")
|
||||
addBlock(MBlocks.POWERED_BLAST_FURNACE.values, "Индукционная печь")
|
||||
addBlock(MBlocks.POWERED_BLAST_FURNACE.values, "desc", "Позволяет обрабатывать рецепты плавильной печи используя энергию")
|
||||
addBlock(MBlocks.POWERED_SMOKER.values, "Микроволновая печь")
|
||||
addBlock(MBlocks.POWERED_SMOKER.values, "desc", "Позволяет обрабатывать рецепты коптильни используя энергию")
|
||||
|
||||
addBlock(MBlocks.MATTER_RECYCLER.values, "Перерабатыватель материи")
|
||||
addBlock(MBlocks.ENERGY_SERVO.values, "Энергетическая помпа")
|
||||
addBlock(MBlocks.ENERGY_SERVO.values, "desc", "заряжает, разряжает и передаёт энергию между предметами")
|
||||
|
||||
@ -532,7 +592,7 @@ private fun items(provider: MatteryLanguageProvider) {
|
||||
add(MItems.EXPLOSIVE_HAMMER, "desc", "Для тех, кому стало скучно")
|
||||
add(MItems.EXPLOSIVE_HAMMER, "primed", "Заряжен!")
|
||||
add(MItems.EXPLOSIVE_HAMMER, "not_primed0", "Не заряжен")
|
||||
add(MItems.EXPLOSIVE_HAMMER, "not_primed1", "Для зарядки добавьте немного пороха и наконечник-самородок")
|
||||
add(MItems.EXPLOSIVE_HAMMER, "not_primed1", "Для зарядки необходимо немного пороха и наконечник-самородок в вашем инвентаре, и зарядите удерживая ПКМ")
|
||||
|
||||
add(MItems.EXOPACK_PROBE, "Маяк экзопака")
|
||||
add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_CREATIVE, "Творческое обновление инвентаря экзопака")
|
||||
|
@ -0,0 +1,91 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.recipes
|
||||
|
||||
import net.minecraft.data.recipes.RecipeCategory
|
||||
import net.minecraft.tags.ItemTags
|
||||
import net.minecraftforge.common.Tags
|
||||
import ru.dbotthepony.mc.otm.registry.MItemTags
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
|
||||
fun addComponentRecipes(consumer: RecipeOutput) {
|
||||
// Обычный рецепт
|
||||
MatteryRecipe(MItems.BASIC_CONTROL_CIRCUIT, count = 3, category = RecipeCategory.MISC)
|
||||
.row(MItemTags.COPPER_WIRES, Tags.Items.DUSTS_REDSTONE, MItemTags.COPPER_WIRES)
|
||||
.row(MItems.CIRCUIT_PLATING, MItems.CIRCUIT_PLATING, MItems.CIRCUIT_PLATING)
|
||||
.unlockedBy(MItemTags.COPPER_WIRES)
|
||||
.build(consumer)
|
||||
|
||||
// ручной рецепт
|
||||
MatteryRecipe(MItems.BASIC_CONTROL_CIRCUIT, category = RecipeCategory.MISC)
|
||||
.rowB(Tags.Items.DUSTS_REDSTONE)
|
||||
.rowB(MItemTags.COPPER_WIRES)
|
||||
.rowB(ItemTags.WOODEN_SLABS)
|
||||
.unlockedBy(MItemTags.COPPER_WIRES)
|
||||
.unlockedBy(Tags.Items.DUSTS_REDSTONE)
|
||||
.build(consumer, "alt")
|
||||
|
||||
MatteryRecipe(MItems.ADVANCED_CONTROL_CIRCUIT, count = 3, category = RecipeCategory.MISC)
|
||||
.row(MItemTags.COPPER_WIRES, Tags.Items.GEMS_QUARTZ, MItemTags.COPPER_WIRES)
|
||||
.row(MItemTags.GOLD_WIRES, Tags.Items.DUSTS_REDSTONE, MItemTags.GOLD_WIRES)
|
||||
.row(MItems.CIRCUIT_PLATING, MItems.CIRCUIT_PLATING, MItems.CIRCUIT_PLATING)
|
||||
.unlockedBy(MItemTags.GOLD_WIRES)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.MACHINE_FRAME, category = RecipeCategory.MISC)
|
||||
.row(MItemTags.HARDENED_GLASS, MItemTags.BASIC_CIRCUIT, MItemTags.HARDENED_GLASS)
|
||||
.row(MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES, MItems.ELECTRIC_PARTS)
|
||||
.rowAC(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)
|
||||
.unlockedBy(MItemTags.BASIC_CIRCUIT)
|
||||
.unlockedBy(MItemTags.HARDENED_GLASS)
|
||||
.unlockedBy(MItems.ELECTRIC_PARTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.GOLD_WIRING, count = 8, category = RecipeCategory.MISC)
|
||||
.rowB(Tags.Items.INGOTS_GOLD)
|
||||
.row(Tags.Items.INGOTS_GOLD, Tags.Items.RODS_WOODEN, Tags.Items.INGOTS_GOLD)
|
||||
.rowB(Tags.Items.INGOTS_GOLD)
|
||||
.unlockedBy(Tags.Items.INGOTS_GOLD)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.COPPER_WIRING, count = 8, category = RecipeCategory.MISC)
|
||||
.rowB(Tags.Items.INGOTS_COPPER)
|
||||
.row(Tags.Items.INGOTS_COPPER, Tags.Items.RODS_WOODEN, Tags.Items.INGOTS_COPPER)
|
||||
.rowB(Tags.Items.INGOTS_COPPER)
|
||||
.unlockedBy(Tags.Items.INGOTS_COPPER)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.ENERGY_BUS, count = 2, category = RecipeCategory.MISC)
|
||||
.rowAB(Tags.Items.DUSTS_REDSTONE, MItems.ELECTRIC_PARTS)
|
||||
.row(MItemTags.COPPER_WIRES, MItemTags.COPPER_WIRES, MItemTags.COPPER_WIRES)
|
||||
.rowBC(MItems.ELECTRIC_PARTS, Tags.Items.DUSTS_REDSTONE)
|
||||
.unlockedBy(MItems.ELECTRIC_PARTS)
|
||||
.unlockedBy(MItemTags.COPPER_WIRES)
|
||||
.unlockedBy(Tags.Items.DUSTS_REDSTONE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.MATTER_IO_PORT, category = RecipeCategory.MISC)
|
||||
.rowB(MItems.MATTER_CABLE)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItemTags.BASIC_CIRCUIT, MItemTags.TRITANIUM_PLATES)
|
||||
.rowB(MItems.MATTER_CABLE)
|
||||
.unlockedBy(MItems.MATTER_CABLE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.MATTER_TRANSFORM_MATRIX, category = RecipeCategory.MISC)
|
||||
.row(Tags.Items.ENDER_PEARLS, MItems.MATTER_CABLE, Tags.Items.ENDER_PEARLS)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItemTags.ADVANCED_CIRCUIT, MItemTags.TRITANIUM_PLATES)
|
||||
.rowB(MItems.MATTER_CABLE)
|
||||
.unlockedBy(MItems.MATTER_CABLE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_PARTS, count = 3, category = RecipeCategory.MISC)
|
||||
.row(MItemTags.IRON_PLATES, MItemTags.HARDENED_GLASS_PANES, MItemTags.IRON_PLATES)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItemTags.HARDENED_GLASS_PANES, MItemTags.TRITANIUM_PLATES)
|
||||
.rowB(MItemTags.HARDENED_GLASS_PANES)
|
||||
.unlockedBy(MItems.MATTER_CABLE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.ELECTRIC_PARTS, count = 4, category = RecipeCategory.MISC)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, MItemTags.COPPER_WIRES, Tags.Items.DUSTS_REDSTONE)
|
||||
.row(Tags.Items.NUGGETS_GOLD, Tags.Items.NUGGETS_IRON, Tags.Items.NUGGETS_GOLD)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, MItemTags.COPPER_WIRES, Tags.Items.DUSTS_REDSTONE)
|
||||
.build(consumer)
|
||||
}
|
@ -55,32 +55,36 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(MItems.HOLO_SIGN)
|
||||
.save(consumer, modLocation("holo_sign_reset"))
|
||||
|
||||
MatteryRecipe(MBlocks.PLATE_PRESS[null]!!, category = machinesCategory)
|
||||
.row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, Items.BLAST_FURNACE, MItemTags.TRITANIUM_INGOTS)
|
||||
.row(MItemTags.PISTONS, MItemTags.TRITANIUM_INGOTS, MItemTags.PISTONS)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.unlockedBy(MItems.ELECTRIC_PARTS)
|
||||
MatteryRecipe(MBlocks.ENERGY_COUNTER[null]!!, category = machinesCategory)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES)
|
||||
.row(MItemTags.BASIC_CIRCUIT, Tags.Items.DUSTS_GLOWSTONE, MItemTags.HARDENED_GLASS_PANES_COLORLESS)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES)
|
||||
.unlockedBy(MItems.ENERGY_BUS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MBlocks.PLATE_PRESS[null]!!, category = machinesCategory)
|
||||
.rowB(MItemTags.PISTONS)
|
||||
.rowB(MItems.MACHINE_FRAME)
|
||||
MatteryRecipe(MBlocks.TWIN_PLATE_PRESS[null]!!, category = machinesCategory)
|
||||
.rowAC(MItems.ELECTROMOTOR, MItems.ELECTROMOTOR)
|
||||
.row(MItemTags.PISTONS, MItems.MACHINE_FRAME, MItemTags.PISTONS)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.unlockedBy(MItems.ELECTRIC_PARTS)
|
||||
.build(consumer, "advanced")
|
||||
.unlockedBy(MItems.MACHINE_FRAME)
|
||||
.build(consumer)
|
||||
|
||||
for ((color, press) in MBlocks.PLATE_PRESS) {
|
||||
for ((color, item) in MItems.PLATE_PRESS) {
|
||||
MatteryRecipe(MBlocks.TWIN_PLATE_PRESS[color]!!, category = machinesCategory)
|
||||
.setUpgradeSource(press)
|
||||
.addUpgradeOps(UpgradeRecipe.Direct("BlockEntityTag"))
|
||||
.rowB(MItemTags.PISTONS)
|
||||
.rowB(press)
|
||||
.rowB(MItemTags.TRITANIUM_PLATES)
|
||||
.unlockedBy(MBlocks.PLATE_PRESS.values)
|
||||
.build(consumer, "twin_plate_press/${color?.name?.lowercase() ?: "default"}")
|
||||
.setUpgradeSource(item)
|
||||
.addUpgradeOps(UpgradeRecipe.All)
|
||||
.rowA(item)
|
||||
.build(consumer, "plate_press_migration/${color?.name?.lowercase() ?: "default"}")
|
||||
}
|
||||
|
||||
MatteryRecipe(MBlocks.CHEMICAL_GENERATOR[null]!!, category = machinesCategory)
|
||||
.rowB(MItems.ENERGY_BUS)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.FURNACES, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowAC(MItems.ELECTRIC_PARTS, MItems.ELECTRIC_PARTS)
|
||||
.unlockedBy(MItemTags.FURNACES)
|
||||
.unlockedBy(MItems.ENERGY_BUS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.PATTERN_DRIVE_NORMAL, category = machinesCategory)
|
||||
.rowAC(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
|
||||
.row(MItemTags.ADVANCED_CIRCUIT, MItemTags.TRITANIUM_PLATES, MItemTags.ADVANCED_CIRCUIT)
|
||||
@ -280,47 +284,9 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
// простые батарейки
|
||||
MatteryRecipe(MItems.BATTERY_CRUDE, category = RecipeCategory.MISC)
|
||||
.rowB(Tags.Items.DUSTS_REDSTONE)
|
||||
.rowB(Tags.Items.CROPS_POTATO)
|
||||
.rowB(Tags.Items.INGOTS_IRON)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.BATTERY_BASIC, category = RecipeCategory.MISC)
|
||||
.rowAC(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
|
||||
.rowB(MItems.ELECTRIC_PARTS)
|
||||
.rowB(MItemTags.IRON_PLATES)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.BATTERY_NORMAL, category = RecipeCategory.MISC)
|
||||
.rowB(MItems.ELECTRIC_PARTS)
|
||||
.row(MItemTags.COPPER_WIRES, MItemTags.IRON_PLATES, MItemTags.COPPER_WIRES)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.BATTERY_DENSE, category = RecipeCategory.MISC)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, MItems.ENERGY_BUS, Tags.Items.DUSTS_REDSTONE)
|
||||
.row(MItemTags.GOLD_WIRES, MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.BATTERY_CAPACITOR, category = RecipeCategory.MISC)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, MItems.ENERGY_BUS, Tags.Items.DUSTS_REDSTONE)
|
||||
.row(MItemTags.GOLD_WIRES, MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
|
||||
.row(MItemTags.GOLD_WIRES, Tags.Items.DUSTS_REDSTONE, MItemTags.GOLD_WIRES)
|
||||
.build(consumer)
|
||||
|
||||
// накопители материи
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_DENSE, category = RecipeCategory.MISC)
|
||||
.row(MItems.MATTER_CAPACITOR_PARTS, Tags.Items.GLASS, MItems.MATTER_CAPACITOR_PARTS)
|
||||
.row(MItemTags.TRITANIUM_PLATES, Tags.Items.ENDER_PEARLS, MItemTags.TRITANIUM_PLATES)
|
||||
.rowAC(Tags.Items.GEMS_DIAMOND, Tags.Items.GEMS_DIAMOND)
|
||||
.build(consumer)
|
||||
|
||||
// станция андроида
|
||||
MatteryRecipe(MItems.ANDROID_STATION[null]!!, category = machinesCategory)
|
||||
.row(MItems.ELECTRIC_PARTS, MItemTags.ADVANCED_CIRCUIT, MItems.ELECTRIC_PARTS)
|
||||
.row(MItems.ELECTRIC_PARTS, MItems.QUANTUM_TRANSCEIVER, MItems.ELECTRIC_PARTS)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES)
|
||||
.build(consumer)
|
||||
@ -332,14 +298,6 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
|
||||
.build(consumer)
|
||||
|
||||
// Энерго меч
|
||||
MatteryRecipe(MItems.ENERGY_SWORD, category = RecipeCategory.COMBAT)
|
||||
.rowBC(MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
|
||||
.rowBC(MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
|
||||
.row(MItems.BATTERY_CAPACITOR, MItems.TRITANIUM_SWORD, MItemTags.ADVANCED_CIRCUIT)
|
||||
.unlockedBy(MItems.BATTERY_CAPACITOR)
|
||||
.buildEnergetic(consumer)
|
||||
|
||||
// апгрейд на сетку крафта
|
||||
MatteryRecipe(MItems.ExopackUpgrades.CRAFTING_UPGRADE, category = RecipeCategory.TOOLS)
|
||||
.row(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
|
||||
@ -416,6 +374,12 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
||||
.build(consumer)
|
||||
}
|
||||
|
||||
MatteryRecipe(MItems.MATTER_SCANNER[null]!!, category = machinesCategory)
|
||||
.row(MItems.MIRROR, MItems.MATTER_TRANSFORM_MATRIX, MItems.MIRROR)
|
||||
.row(MItemTags.HARDENED_GLASS_COLORLESS, MItems.MACHINE_FRAME, MItemTags.HARDENED_GLASS_COLORLESS)
|
||||
.row(MItems.MATTER_CABLE, MItemTags.ADVANCED_CIRCUIT, MItems.MATTER_CABLE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.FLUID_CAPSULE, category = RecipeCategory.TOOLS, count = 8)
|
||||
.row(MItemTags.TRITANIUM_NUGGETS, MItemTags.TRITANIUM_NUGGETS, MItemTags.TRITANIUM_NUGGETS)
|
||||
.rowB(MItemTags.HARDENED_GLASS_PANES)
|
||||
|
@ -274,7 +274,6 @@ fun addPainterRecipes(consumer: RecipeOutput) {
|
||||
val blocks = listOf(
|
||||
MItems.COBBLESTONE_GENERATOR,
|
||||
MItems.ESSENCE_STORAGE,
|
||||
MItems.PLATE_PRESS,
|
||||
MItems.TWIN_PLATE_PRESS,
|
||||
MItems.ITEM_MONITOR,
|
||||
MItems.MATTER_BOTTLER,
|
||||
|
@ -0,0 +1,73 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.recipes
|
||||
|
||||
import net.minecraft.data.recipes.RecipeCategory
|
||||
import net.minecraftforge.common.Tags
|
||||
import ru.dbotthepony.mc.otm.recipe.UpgradeRecipe
|
||||
import ru.dbotthepony.mc.otm.registry.MItemTags
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
|
||||
fun addStorageItemRecipes(consumer: RecipeOutput) {
|
||||
// простые батарейки
|
||||
MatteryRecipe(MItems.BATTERY_CRUDE, category = RecipeCategory.MISC)
|
||||
.rowB(Tags.Items.DUSTS_REDSTONE)
|
||||
.rowB(Tags.Items.CROPS_POTATO)
|
||||
.rowB(Tags.Items.INGOTS_IRON)
|
||||
.unlockedBy(Tags.Items.CROPS_POTATO)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.BATTERY_BASIC, category = RecipeCategory.MISC)
|
||||
.rowAC(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
|
||||
.rowB(MItems.ELECTRIC_PARTS)
|
||||
.rowB(MItemTags.IRON_PLATES)
|
||||
.unlockedBy(Tags.Items.DUSTS_REDSTONE)
|
||||
.unlockedBy(MItems.ELECTRIC_PARTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.BATTERY_NORMAL, category = RecipeCategory.MISC)
|
||||
.setUpgradeSource(MItems.BATTERY_BASIC)
|
||||
.addUpgradeOps(UpgradeRecipe.All)
|
||||
.rowB(MItems.ELECTRIC_PARTS)
|
||||
.row(MItemTags.COPPER_WIRES, MItems.BATTERY_BASIC, MItemTags.COPPER_WIRES)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.BATTERY_DENSE, category = RecipeCategory.MISC)
|
||||
.setUpgradeSource(MItems.BATTERY_NORMAL)
|
||||
.addUpgradeOps(UpgradeRecipe.All)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, MItems.ENERGY_BUS, Tags.Items.DUSTS_REDSTONE)
|
||||
.row(MItemTags.GOLD_WIRES, MItems.BATTERY_NORMAL, MItemTags.GOLD_WIRES)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.BATTERY_CAPACITOR, category = RecipeCategory.MISC)
|
||||
.setUpgradeSource(MItems.BATTERY_NORMAL)
|
||||
.addUpgradeOps(UpgradeRecipe.All)
|
||||
.row(Tags.Items.DUSTS_REDSTONE, MItems.ENERGY_BUS, Tags.Items.DUSTS_REDSTONE)
|
||||
.row(MItemTags.GOLD_WIRES, MItems.BATTERY_NORMAL, MItemTags.GOLD_WIRES)
|
||||
.row(MItemTags.GOLD_WIRES, Tags.Items.DUSTS_REDSTONE, MItemTags.GOLD_WIRES)
|
||||
.build(consumer)
|
||||
|
||||
// накопители материи
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_BASIC, category = RecipeCategory.MISC)
|
||||
.row(MItemTags.IRON_PLATES, MItems.MATTER_CAPACITOR_PARTS, MItemTags.HARDENED_GLASS)
|
||||
.unlockedBy(MItems.MATTER_CAPACITOR_PARTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_NORMAL, category = RecipeCategory.MISC)
|
||||
.setUpgradeSource(MItems.MATTER_CAPACITOR_BASIC)
|
||||
.addUpgradeOps(UpgradeRecipe.All)
|
||||
.rowB(MItems.MATTER_CAPACITOR_PARTS)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.MATTER_CAPACITOR_BASIC, MItemTags.TRITANIUM_PLATES)
|
||||
.rowB(Tags.Items.GEMS_DIAMOND)
|
||||
.unlockedBy(MItems.MATTER_CAPACITOR_BASIC)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.MATTER_CAPACITOR_DENSE, category = RecipeCategory.MISC)
|
||||
.setUpgradeSource(MItems.MATTER_CAPACITOR_NORMAL)
|
||||
.addUpgradeOps(UpgradeRecipe.All)
|
||||
.row(MItems.MATTER_CAPACITOR_PARTS, MItemTags.HARDENED_GLASS, MItems.MATTER_CAPACITOR_PARTS)
|
||||
.row(MItemTags.TRITANIUM_PLATES, MItems.MATTER_CAPACITOR_NORMAL, MItemTags.TRITANIUM_PLATES)
|
||||
.rowAC(Tags.Items.ENDER_PEARLS, Tags.Items.ENDER_PEARLS)
|
||||
.unlockedBy(MItems.MATTER_CAPACITOR_NORMAL)
|
||||
.build(consumer)
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package ru.dbotthepony.mc.otm.datagen.recipes
|
||||
|
||||
import net.minecraft.data.recipes.RecipeCategory
|
||||
import net.minecraftforge.common.Tags
|
||||
import ru.dbotthepony.mc.otm.registry.MItemTags
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
|
||||
fun addToolsRecipes(consumer: RecipeOutput) {
|
||||
MatteryRecipe(MItems.ENERGY_SWORD, category = RecipeCategory.COMBAT)
|
||||
.row(MItemTags.CARBON_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
|
||||
.row(MItemTags.CARBON_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
|
||||
.row(MItems.BATTERY_CAPACITOR, MItems.TRITANIUM_SWORD, MItemTags.ADVANCED_CIRCUIT)
|
||||
.unlockedBy(MItems.BATTERY_CAPACITOR)
|
||||
.buildEnergetic(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_SWORD, category = RecipeCategory.COMBAT)
|
||||
.rowB(MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_SHOVEL, category = RecipeCategory.TOOLS)
|
||||
.rowB(MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_PICKAXE, category = RecipeCategory.TOOLS)
|
||||
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_AXE, category = RecipeCategory.TOOLS)
|
||||
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowAB(MItemTags.TRITANIUM_INGOTS, Tags.Items.RODS_WOODEN)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_AXE, category = RecipeCategory.TOOLS)
|
||||
.rowBC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowBC(Tags.Items.RODS_WOODEN, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer, "alt")
|
||||
|
||||
MatteryRecipe(MItems.TRITANIUM_HOE, category = RecipeCategory.TOOLS)
|
||||
.rowBC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.rowB(Tags.Items.RODS_WOODEN)
|
||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||
.build(consumer)
|
||||
}
|
@ -55,6 +55,7 @@ fun addTags(tagsProvider: TagsProvider) {
|
||||
tagsProvider.items.Appender(MItemTags.CRAFTING_TABLES).add(Items.CRAFTING_TABLE)
|
||||
tagsProvider.items.Appender(MItemTags.WORKBENCHES).add(Items.CRAFTING_TABLE)
|
||||
tagsProvider.items.Appender(MItemTags.WORKBENCH).add(Items.CRAFTING_TABLE)
|
||||
tagsProvider.items.Appender(MItemTags.FURNACES).add(Items.FURNACE)
|
||||
tagsProvider.blocks.Appender(MBlockTags.CRAFTING_TABLES).add(Blocks.CRAFTING_TABLE)
|
||||
tagsProvider.blocks.Appender(MBlockTags.WORKBENCHES).add(Blocks.CRAFTING_TABLE)
|
||||
tagsProvider.blocks.Appender(MBlockTags.WORKBENCH).add(Blocks.CRAFTING_TABLE)
|
||||
|
@ -32,9 +32,8 @@ import ru.dbotthepony.mc.otm.block.entity.IRedstoneControlled
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||
import ru.dbotthepony.mc.otm.core.ITooltippable
|
||||
import ru.dbotthepony.mc.otm.core.TooltipList
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.addDescriptionFunctions
|
||||
import ru.dbotthepony.mc.otm.core.asSupplier
|
||||
import ru.dbotthepony.mc.otm.core.collect.SupplierMap
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
@ -83,7 +82,9 @@ fun interface INeighbourChangeListener {
|
||||
)
|
||||
}
|
||||
|
||||
open class MatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : Block(properties), INeighbourChangeListener, ITooltippable by ITooltippable.Impl() {
|
||||
open class MatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : Block(properties), INeighbourChangeListener {
|
||||
val tooltips = TooltipList()
|
||||
|
||||
override fun setPlacedBy(
|
||||
level: Level,
|
||||
blockPos: BlockPos,
|
||||
@ -261,7 +262,7 @@ open class MatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : Block(pro
|
||||
|
||||
override fun appendHoverText(itemStack: ItemStack, blockAccessor: BlockGetter?, components: MutableList<Component>, tooltipType: TooltipFlag) {
|
||||
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
assembleDescription(itemStack, components)
|
||||
tooltips.assemble(itemStack, components)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@ -271,5 +272,6 @@ open class MatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : Block(pro
|
||||
}
|
||||
|
||||
fun <T : MatteryBlock> T.addSimpleDescription(suffix: String = "", formatting: ChatFormatting = ChatFormatting.GRAY): T {
|
||||
return addDescriptionFunctions { ObjectIterators.singleton(TranslatableComponent("$descriptionId.desc$suffix").withStyle(formatting)) }
|
||||
tooltips.add { TranslatableComponent("$descriptionId.desc$suffix").withStyle(formatting) }
|
||||
return this
|
||||
}
|
||||
|
@ -14,7 +14,9 @@ import net.minecraft.world.level.block.DoorBlock
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import ru.dbotthepony.mc.otm.core.TooltipList
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.collect.iteratorOf
|
||||
|
||||
class TritaniumDoorBlock(val color: DyeColor?) : DoorBlock(
|
||||
Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE)
|
||||
@ -24,6 +26,14 @@ class TritaniumDoorBlock(val color: DyeColor?) : DoorBlock(
|
||||
.requiresCorrectToolForDrops(),
|
||||
SoundEvents.IRON_DOOR_CLOSE, SoundEvents.IRON_DOOR_OPEN
|
||||
) {
|
||||
val tooltips = TooltipList()
|
||||
|
||||
init {
|
||||
tooltips.add { TranslatableComponent("$descriptionId.description0").withStyle(ChatFormatting.DARK_GRAY) }
|
||||
tooltips.add { TranslatableComponent("$descriptionId.description1").withStyle(ChatFormatting.DARK_GRAY) }
|
||||
tooltips.painted(color)
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
p_49816_: ItemStack,
|
||||
p_49817_: BlockGetter?,
|
||||
@ -31,12 +41,7 @@ class TritaniumDoorBlock(val color: DyeColor?) : DoorBlock(
|
||||
p_49819_: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
||||
p_49818_.add(TranslatableComponent("$descriptionId.description0").withStyle(ChatFormatting.DARK_GRAY))
|
||||
p_49818_.add(TranslatableComponent("$descriptionId.description1").withStyle(ChatFormatting.DARK_GRAY))
|
||||
|
||||
if (color != null) {
|
||||
p_49818_.add(TranslatableComponent("$descriptionId.description2").withStyle(ChatFormatting.DARK_GRAY))
|
||||
}
|
||||
tooltips.assemble(p_49816_, p_49818_)
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_52814_: BlockState): PushReaction {
|
||||
|
@ -19,22 +19,28 @@ import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties
|
||||
import net.minecraft.world.level.material.Material
|
||||
import net.minecraft.world.level.material.PushReaction
|
||||
import ru.dbotthepony.mc.otm.core.TooltipList
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.collect.iteratorOf
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
|
||||
class TritaniumPressurePlate(color: DyeColor?) : BasePressurePlateBlock(Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE).sound(SoundType.METAL).explosionResistance(80f).noOcclusion().destroyTime(3f).requiresCorrectToolForDrops()) {
|
||||
val tooltips = TooltipList()
|
||||
override fun appendHoverText(
|
||||
p_49816_: ItemStack,
|
||||
p_49817_: BlockGetter?,
|
||||
p_49818_: MutableList<Component>,
|
||||
p_49819_: TooltipFlag
|
||||
itemStack: ItemStack,
|
||||
level: BlockGetter?,
|
||||
lines: MutableList<Component>,
|
||||
tooltipType: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
||||
p_49818_.add(TranslatableComponent("$descriptionId.description0").withStyle(ChatFormatting.DARK_GRAY))
|
||||
p_49818_.add(TranslatableComponent("$descriptionId.description1").withStyle(ChatFormatting.DARK_GRAY))
|
||||
super.appendHoverText(itemStack, level, lines, tooltipType)
|
||||
tooltips.assemble(itemStack, lines)
|
||||
}
|
||||
|
||||
init {
|
||||
tooltips.add { TranslatableComponent("$descriptionId.description0").withStyle(ChatFormatting.DARK_GRAY) }
|
||||
tooltips.add { TranslatableComponent("$descriptionId.description1").withStyle(ChatFormatting.DARK_GRAY) }
|
||||
tooltips.painted(color)
|
||||
registerDefaultState(stateDefinition.any().setValue(BlockStateProperties.POWERED, false))
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,10 @@ import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.block.TrapDoorBlock
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import ru.dbotthepony.mc.otm.core.TooltipList
|
||||
import net.minecraft.world.level.material.Material
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.collect.iteratorOf
|
||||
|
||||
class TritaniumTrapdoorBlock(val color: DyeColor?) : TrapDoorBlock(
|
||||
Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE)
|
||||
@ -24,6 +26,14 @@ class TritaniumTrapdoorBlock(val color: DyeColor?) : TrapDoorBlock(
|
||||
.isValidSpawn { _: BlockState, _: BlockGetter, _: BlockPos, _: EntityType<*>? -> false },
|
||||
SoundEvents.IRON_DOOR_CLOSE, SoundEvents.IRON_DOOR_OPEN
|
||||
) {
|
||||
val tooltips = TooltipList()
|
||||
|
||||
init {
|
||||
tooltips.add { TranslatableComponent("$descriptionId.description0").withStyle(ChatFormatting.DARK_GRAY) }
|
||||
tooltips.add { TranslatableComponent("$descriptionId.description1").withStyle(ChatFormatting.DARK_GRAY) }
|
||||
tooltips.painted(color)
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
p_49816_: ItemStack,
|
||||
p_49817_: BlockGetter?,
|
||||
@ -31,12 +41,7 @@ class TritaniumTrapdoorBlock(val color: DyeColor?) : TrapDoorBlock(
|
||||
p_49819_: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
||||
p_49818_.add(TranslatableComponent("$descriptionId.description0").withStyle(ChatFormatting.DARK_GRAY))
|
||||
p_49818_.add(TranslatableComponent("$descriptionId.description1").withStyle(ChatFormatting.DARK_GRAY))
|
||||
|
||||
if (color != null) {
|
||||
p_49818_.add(TranslatableComponent("$descriptionId.description2").withStyle(ChatFormatting.DARK_GRAY))
|
||||
}
|
||||
tooltips.assemble(p_49816_, p_49818_)
|
||||
}
|
||||
|
||||
override fun canEntityDestroy(
|
||||
|
@ -51,6 +51,7 @@ import ru.dbotthepony.mc.otm.core.math.plus
|
||||
import ru.dbotthepony.mc.otm.core.util.IntCounter
|
||||
import ru.dbotthepony.mc.otm.core.util.Savetables
|
||||
import ru.dbotthepony.mc.otm.core.util.TickList
|
||||
import ru.dbotthepony.mc.otm.core.util.countingLazy
|
||||
import ru.dbotthepony.mc.otm.network.BlockEntitySyncPacket
|
||||
import ru.dbotthepony.mc.otm.network.GenericNetworkChannel
|
||||
import ru.dbotthepony.mc.otm.network.synchronizer.FieldSynchronizer
|
||||
@ -73,20 +74,39 @@ import kotlin.reflect.KProperty
|
||||
abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: BlockPos, p_155230_: BlockState) : BlockEntity(p_155228_, p_155229_, p_155230_), INeighbourChangeListener {
|
||||
private var isSynchronizing = false
|
||||
|
||||
/**
|
||||
* "shortcut" for getting [BlockRotation]
|
||||
*
|
||||
* if block has no rotation, returns [BlockRotation.NORTH]
|
||||
*/
|
||||
open val blockRotation: BlockRotation get() {
|
||||
return blockState[(blockState.block as? RotatableMatteryBlock ?: return BlockRotation.NORTH).rotationProperty]
|
||||
}
|
||||
private val sidelessCaps = Reference2ObjectOpenHashMap<Capability<*>, SidelessCap<*>>()
|
||||
protected val tickList = TickList()
|
||||
protected val blockStateChangesCounter = IntCounter()
|
||||
protected val dirtyListeners = ISubscriptable.Impl<Unit>()
|
||||
private val waitForServerLevel = ArrayList<() -> Unit>()
|
||||
|
||||
private val _droppableContainers = ObjectArraySet<Container>()
|
||||
private val _neighbourChangeListeners = ObjectArraySet<INeighbourChangeListener>()
|
||||
val droppableContainers: Set<Container> = Collections.unmodifiableSet(_droppableContainers)
|
||||
val neighbourChangeListeners: Set<INeighbourChangeListener> = Collections.unmodifiableSet(_neighbourChangeListeners)
|
||||
|
||||
private val _sides = EnumMap<RelativeSide, Side>(RelativeSide::class.java)
|
||||
val sides: Map<RelativeSide, Side> = Collections.unmodifiableMap(_sides)
|
||||
|
||||
/**
|
||||
* Shared savetables, written both to level storage and to item tag
|
||||
*/
|
||||
protected val savetables = Savetables()
|
||||
|
||||
/**
|
||||
* Level-only savetables, written only to level storage
|
||||
*/
|
||||
protected val savetablesLevel = Savetables()
|
||||
|
||||
/**
|
||||
* "shortcut" for getting [BlockRotation]
|
||||
*
|
||||
* if block has no rotation, returns [BlockRotation.NORTH]
|
||||
*/
|
||||
open val blockRotation: BlockRotation by countingLazy(blockStateChangesCounter) {
|
||||
blockState[(blockState.block as? RotatableMatteryBlock ?: return@countingLazy BlockRotation.NORTH).rotationProperty]
|
||||
}
|
||||
|
||||
protected fun addDroppableContainer(container: Container) {
|
||||
_droppableContainers.add(container)
|
||||
}
|
||||
@ -101,27 +121,9 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
|
||||
open fun beforeDroppingItems(oldBlockState: BlockState, level: Level, blockPos: BlockPos, newBlockState: BlockState, movedByPiston: Boolean) {}
|
||||
open fun beforeDestroyedByPlayer(level: Level, blockPos: BlockPos, blockState: BlockState, player: Player) {}
|
||||
|
||||
private val _sides = EnumMap<RelativeSide, Side>(RelativeSide::class.java)
|
||||
val sides: Map<RelativeSide, Side> = Collections.unmodifiableMap(_sides)
|
||||
|
||||
fun side(side: RelativeSide) = sides[side]!!
|
||||
|
||||
private data class SidelessCap<T : Any>(val cap: T, var optional: LazyOptional<T>)
|
||||
private val sidelessCaps = Reference2ObjectOpenHashMap<Capability<*>, SidelessCap<*>>()
|
||||
protected val tickList = TickList()
|
||||
protected val blockStateChangesCounter = IntCounter()
|
||||
protected val dirtyListeners = ISubscriptable.Impl<Unit>()
|
||||
private val waitForServerLevel = ArrayList<() -> Unit>()
|
||||
|
||||
/**
|
||||
* Shared savetables, written both to level storage and to item tag
|
||||
*/
|
||||
protected val savetables = Savetables()
|
||||
|
||||
/**
|
||||
* Level-only savetables, written only to level storage
|
||||
*/
|
||||
protected val savetablesLevel = Savetables()
|
||||
|
||||
open fun tick() {
|
||||
tickList.tick()
|
||||
@ -441,8 +443,8 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
|
||||
|
||||
@Suppress("OVERRIDE_DEPRECATION")
|
||||
override fun setBlockState(pBlockState: BlockState) {
|
||||
blockStateChangesCounter.increment()
|
||||
val old = blockRotation
|
||||
blockStateChangesCounter.increment()
|
||||
@Suppress("DEPRECATION")
|
||||
super.setBlockState(pBlockState)
|
||||
val new = blockRotation
|
||||
|
@ -1,25 +1,15 @@
|
||||
package ru.dbotthepony.mc.otm.block.entity
|
||||
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.nbt.CompoundTag
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.item.BlockItem
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities
|
||||
import ru.dbotthepony.mc.otm.capability.*
|
||||
import ru.dbotthepony.mc.otm.capability.energy.IMatteryEnergyStorage
|
||||
import ru.dbotthepony.mc.otm.capability.energy.ItemEnergyStorageImpl
|
||||
import ru.dbotthepony.mc.otm.capability.extractEnergy
|
||||
import ru.dbotthepony.mc.otm.container.HandlerFilter
|
||||
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.core.ifPresentK
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.nbt.map
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
|
||||
abstract class MatteryPoweredBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: BlockPos, p_155230_: BlockState) : MatteryDeviceBlockEntity(p_155228_, p_155229_, p_155230_) {
|
||||
val batteryContainer = MatteryContainer(::markDirtyFast, 1).also(::addDroppableContainer)
|
||||
@ -51,18 +41,4 @@ abstract class MatteryPoweredBlockEntity(p_155228_: BlockEntityType<*>, p_155229
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun appendHoverText(itemStack: ItemStack, blockGetter: BlockGetter?, tooltips: MutableList<Component>, flag: TooltipFlag) {
|
||||
val tag = itemStack.tag?.get(BlockItem.BLOCK_ENTITY_TAG) as? CompoundTag ?: return
|
||||
val container = MatteryContainer(1)
|
||||
tag.map(BATTERY_KEY, container::deserializeNBT)
|
||||
|
||||
if (!container[0].isEmpty) {
|
||||
tooltips.add(TranslatableComponent("otm.item.block.stored_battery", container[0].displayName).withStyle(ChatFormatting.GRAY))
|
||||
|
||||
ItemEnergyStorageImpl.appendHoverText(container[0], tooltips)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,15 +160,4 @@ abstract class MatteryWorkerBlockEntity<JobType : IJob>(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val LOGGER = LogManager.getLogger()
|
||||
|
||||
fun appendHoverText(itemStack: ItemStack, blockGetter: BlockGetter?, tooltips: MutableList<Component>, flag: TooltipFlag) {
|
||||
itemStack.tag ?: return
|
||||
|
||||
WorkerEnergyStorage.appendHoverText(itemStack, blockGetter, tooltips, flag)
|
||||
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockGetter, tooltips, flag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class MatterBottlerBlockEntity(blockPos: BlockPos, blockState: BlockState) :
|
||||
battery = batteryItemHandler
|
||||
)
|
||||
|
||||
val matter: ProfiledMatterStorage<MatterStorageImpl> = ProfiledMatterStorage(object : MatterStorageImpl(this::markDirtyFast, FlowDirection.BI_DIRECTIONAL, upgrades.matterCapacity(MachinesConfig.MatterBottler.VALUES::matterCapacity)) {
|
||||
val matter: ProfiledMatterStorage<MatterStorageImpl> = ProfiledMatterStorage(object : MatterStorageImpl(this@MatterBottlerBlockEntity::markDirtyFast, FlowDirection.BI_DIRECTIONAL, upgrades.matterCapacity(MachinesConfig.MatterBottler.VALUES::matterCapacity)) {
|
||||
override val matterFlow: FlowDirection get() {
|
||||
return if (this@MatterBottlerBlockEntity.isBottling) FlowDirection.INPUT else FlowDirection.OUTPUT
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState)
|
||||
}
|
||||
|
||||
if (summ.isPositive && !simulate) {
|
||||
gaugeLevel = (storedMatter / maxStoredMatter).toFloat()
|
||||
gaugeLevel = storedMatter.percentage(maxStoredMatter)
|
||||
}
|
||||
|
||||
return summ
|
||||
@ -111,7 +111,7 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState)
|
||||
}
|
||||
|
||||
if (summ.isPositive && !simulate) {
|
||||
gaugeLevel = (storedMatter / maxStoredMatter).toFloat()
|
||||
gaugeLevel = storedMatter.percentage(maxStoredMatter)
|
||||
}
|
||||
|
||||
return summ
|
||||
@ -124,7 +124,7 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState)
|
||||
override fun setChanged(slot: Int, new: ItemStack, old: ItemStack) {
|
||||
super.setChanged(slot, new, old)
|
||||
capacitorStatus[slot].boolean = new.getCapability(MatteryCapability.MATTER).isPresent
|
||||
gaugeLevel = (storedMatter / maxStoredMatter).toFloat()
|
||||
gaugeLevel = storedMatter.percentage(maxStoredMatter)
|
||||
}
|
||||
|
||||
override fun getMaxStackSize(): Int = 1
|
||||
|
@ -1,6 +1,5 @@
|
||||
package ru.dbotthepony.mc.otm.block.entity.matter
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
||||
@ -11,7 +10,6 @@ import net.minecraft.world.entity.player.Inventory
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu
|
||||
import ru.dbotthepony.mc.otm.menu.matter.PatternStorageMenu
|
||||
import net.minecraft.MethodsReturnNonnullByDefault
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.block.Block
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
|
||||
@ -26,8 +24,6 @@ import ru.dbotthepony.mc.otm.graph.matter.SimpleMatterNode
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import java.util.stream.Stream
|
||||
|
||||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
class PatternStorageBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
|
||||
MatteryDeviceBlockEntity(MBlockEntities.PATTERN_STORAGE, p_155229_, p_155230_), IPatternStorage {
|
||||
|
||||
|
@ -22,6 +22,7 @@ import ru.dbotthepony.mc.otm.core.nbt.getByteArrayList
|
||||
import ru.dbotthepony.mc.otm.core.nbt.map
|
||||
import ru.dbotthepony.mc.otm.core.nbt.mapPresent
|
||||
import ru.dbotthepony.mc.otm.core.nbt.set
|
||||
import ru.dbotthepony.mc.otm.core.util.countingLazy
|
||||
import ru.dbotthepony.mc.otm.menu.tech.EnergyCounterMenu
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import java.util.*
|
||||
@ -29,8 +30,8 @@ import java.util.*
|
||||
class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : MatteryDeviceBlockEntity(MBlockEntities.ENERGY_COUNTER, p_155229_, p_155230_) {
|
||||
var passed by synchronizer.decimal()
|
||||
|
||||
override val blockRotation: BlockRotation get() {
|
||||
return BlockRotation.of(blockState[EnergyCounterBlock.INPUT_DIRECTION])
|
||||
override val blockRotation: BlockRotation by countingLazy(blockStateChangesCounter) {
|
||||
BlockRotation.of(blockState[EnergyCounterBlock.INPUT_DIRECTION])
|
||||
}
|
||||
|
||||
private val history = Array(10 * 20) { Decimal.ZERO }
|
||||
|
@ -24,7 +24,6 @@ import ru.dbotthepony.mc.otm.core.collect.filter
|
||||
import ru.dbotthepony.mc.otm.core.collect.maybe
|
||||
import ru.dbotthepony.mc.otm.core.value
|
||||
import ru.dbotthepony.mc.otm.menu.tech.PlatePressMenu
|
||||
import ru.dbotthepony.mc.otm.menu.tech.TwinPlatePressMenu
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.registry.MRecipes
|
||||
|
||||
@ -56,10 +55,7 @@ class PlatePressBlockEntity(
|
||||
}
|
||||
|
||||
override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu {
|
||||
if (isTwin)
|
||||
return TwinPlatePressMenu(containerID, inventory, this)
|
||||
else
|
||||
return PlatePressMenu(containerID, inventory, this)
|
||||
return if (isTwin) PlatePressMenu.twin(containerID, inventory, this) else PlatePressMenu.single(containerID, inventory, this)
|
||||
}
|
||||
|
||||
override fun onJobFinish(status: JobStatus<ItemJob>, id: Int) {
|
||||
|
@ -16,6 +16,7 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterBottlerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
@ -24,6 +25,13 @@ import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class MatterBottlerBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.colored(color)
|
||||
addSimpleDescription()
|
||||
tooltips.blockEntityEnergy()
|
||||
tooltips.blockEntityMatter()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return MatterBottlerBlockEntity(blockPos, blockState)
|
||||
}
|
||||
@ -36,7 +44,7 @@ class MatterBottlerBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_M
|
||||
if (p_153212_.isClientSide || p_153214_ !== MBlockEntities.MATTER_BOTTLER)
|
||||
return null
|
||||
|
||||
return BlockEntityTicker {_, _, _, tile -> if (tile is MatterBottlerBlockEntity) tile.tick()}
|
||||
return BlockEntityTicker { _, _, _, tile -> if (tile is MatterBottlerBlockEntity) tile.tick() }
|
||||
}
|
||||
|
||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||
|
@ -14,12 +14,18 @@ import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.tech.BatteryBankBlock
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterCapacitorBankBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class MatterCapacitorBankBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.colored(color)
|
||||
addSimpleDescription()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return MatterCapacitorBankBlockEntity(blockPos, blockState)
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package ru.dbotthepony.mc.otm.block.matter
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault
|
||||
import javax.annotation.ParametersAreNonnullByDefault
|
||||
import net.minecraft.world.level.block.EntityBlock
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.world.item.DyeColor
|
||||
@ -17,6 +15,7 @@ import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
@ -24,6 +23,13 @@ import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class MatterDecomposerBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.colored(color)
|
||||
addSimpleDescription()
|
||||
tooltips.blockEntityEnergy()
|
||||
tooltips.blockEntityMatter()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return MatterDecomposerBlockEntity(blockPos, blockState)
|
||||
}
|
||||
|
@ -11,6 +11,11 @@ import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterEntanglerBlockEntity
|
||||
|
||||
class MatterEntanglerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.blockEntityEnergy()
|
||||
tooltips.blockEntityMatter()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return MatterEntanglerBlockEntity(blockPos, blockState)
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package ru.dbotthepony.mc.otm.block.matter
|
||||
|
||||
import com.google.common.collect.ImmutableMap
|
||||
import net.minecraft.world.level.block.EntityBlock
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
@ -14,11 +13,17 @@ import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.item.context.BlockPlaceContext
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.core.math.BlockRotation
|
||||
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
|
||||
|
||||
class MatterPanelBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.colored(color)
|
||||
addSimpleDescription()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return MatterPanelBlockEntity(blockPos, blockState)
|
||||
}
|
||||
|
@ -19,6 +19,13 @@ import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class MatterReconstructorBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.colored(color)
|
||||
addSimpleDescription()
|
||||
tooltips.blockEntityEnergy("energy")
|
||||
tooltips.blockEntityMatter("matter")
|
||||
}
|
||||
|
||||
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
|
||||
return MatterReconstructorBlockEntity(pPos, pState)
|
||||
}
|
||||
@ -30,10 +37,6 @@ class MatterReconstructorBlock(val color: DyeColor?) : RotatableMatteryBlock(DEF
|
||||
return BlockEntityTicker { _, _, _, pBlockEntity -> if (pBlockEntity is MatterReconstructorBlockEntity) pBlockEntity.tick() }
|
||||
}
|
||||
|
||||
init {
|
||||
addSimpleDescription()
|
||||
}
|
||||
|
||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.MATTER_RECONSTRUCTOR.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||
|
||||
@Suppress("override_deprecation")
|
||||
|
@ -14,6 +14,7 @@ import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterRecyclerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
@ -22,6 +23,13 @@ import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class MatterRecyclerBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.colored(color)
|
||||
addSimpleDescription()
|
||||
tooltips.blockEntityEnergy()
|
||||
tooltips.blockEntityMatter()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||
return MatterRecyclerBlockEntity(p_153215_, p_153216_)
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterReplicatorBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
@ -22,6 +23,13 @@ import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class MatterReplicatorBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.colored(color)
|
||||
addSimpleDescription()
|
||||
tooltips.blockEntityEnergy()
|
||||
tooltips.blockEntityMatter()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return MatterReplicatorBlockEntity(blockPos, blockState)
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterScannerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
@ -22,6 +23,12 @@ import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class MatterScannerBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.colored(color)
|
||||
addSimpleDescription()
|
||||
tooltips.blockEntityEnergy()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return MatterScannerBlockEntity(blockPos, blockState)
|
||||
}
|
||||
|
@ -14,12 +14,17 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.matter.PatternStorageBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class PatternStorageBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
addSimpleDescription()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return PatternStorageBlockEntity(blockPos, blockState)
|
||||
}
|
||||
@ -38,25 +43,6 @@ class PatternStorageBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), E
|
||||
return state
|
||||
}
|
||||
|
||||
override fun onRemove(
|
||||
oldBlockState: BlockState,
|
||||
level: Level,
|
||||
blockPos: BlockPos,
|
||||
newBlockState: BlockState,
|
||||
movedByPiston: Boolean
|
||||
) {
|
||||
if (!oldBlockState.`is`(newBlockState.block)) {
|
||||
val blockentity = level.getBlockEntity(blockPos)
|
||||
|
||||
if (blockentity is PatternStorageBlockEntity) {
|
||||
Containers.dropContents(level, blockPos, blockentity.container)
|
||||
level.updateNeighbourForOutputSignal(blockPos, this)
|
||||
}
|
||||
}
|
||||
|
||||
super.onRemove(oldBlockState, level, blockPos, newBlockState, movedByPiston)
|
||||
}
|
||||
|
||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.PATTERN_STORAGE.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||
|
||||
@Suppress("override_deprecation")
|
||||
|
@ -23,6 +23,10 @@ import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class DriveRackBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.blockEntityEnergy()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return DriveRackBlockEntity(blockPos, blockState)
|
||||
}
|
||||
@ -38,17 +42,6 @@ class DriveRackBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Entity
|
||||
return BlockEntityTicker { _, _, _, tile -> if (tile is DriveRackBlockEntity) tile.tick() }
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
tooltipType: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
}
|
||||
|
||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.DRIVE_RACK.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||
|
||||
@Suppress("override_deprecation")
|
||||
|
@ -29,6 +29,11 @@ import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class DriveViewerBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.colored(color)
|
||||
tooltips.blockEntityEnergy()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return DriveViewerBlockEntity(blockPos, blockState)
|
||||
}
|
||||
@ -50,17 +55,6 @@ class DriveViewerBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MAC
|
||||
builder.add(DRIVE_PRESENT)
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
tooltipType: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
}
|
||||
|
||||
override fun getStateForPlacement(context: BlockPlaceContext): BlockState {
|
||||
return super.getStateForPlacement(context)!!.setValue(DRIVE_PRESENT, false)
|
||||
}
|
||||
|
@ -24,6 +24,11 @@ import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class ItemMonitorBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.colored(color)
|
||||
tooltips.blockEntityEnergy()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return ItemMonitorBlockEntity(blockPos, blockState)
|
||||
}
|
||||
@ -39,17 +44,6 @@ class ItemMonitorBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MAC
|
||||
return BlockEntityTicker { _, _, _, tile -> if (tile is ItemMonitorBlockEntity) tile.tick() }
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
tooltipType: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
}
|
||||
|
||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.ITEM_MONITOR.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||
|
||||
@Suppress("override_deprecation")
|
||||
|
@ -32,6 +32,10 @@ import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
import ru.dbotthepony.mc.otm.core.math.unaryMinus
|
||||
|
||||
class StorageBusBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.blockEntityEnergy()
|
||||
}
|
||||
|
||||
override fun rotationFreedom(): BlockRotationFreedom {
|
||||
return BlockRotationFreedom.DIRECTIONAL
|
||||
}
|
||||
@ -54,17 +58,6 @@ class StorageBusBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Entit
|
||||
return super.getStateForPlacement(context)?.setValue(BlockRotationFreedom.DIRECTIONAL.property, BlockRotation.of(-context.clickedFace))
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
tooltipType: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
}
|
||||
|
||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||
super.createBlockStateDefinition(builder)
|
||||
|
||||
|
@ -32,6 +32,10 @@ import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
import ru.dbotthepony.mc.otm.core.math.unaryMinus
|
||||
|
||||
class StorageImporterBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.blockEntityEnergy()
|
||||
}
|
||||
|
||||
override fun rotationFreedom(): BlockRotationFreedom {
|
||||
return BlockRotationFreedom.DIRECTIONAL
|
||||
}
|
||||
@ -78,17 +82,6 @@ class StorageImporterBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES),
|
||||
return super.getStateForPlacement(context)?.setValue(BlockRotationFreedom.DIRECTIONAL.property, BlockRotation.of(-context.clickedFace))
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
tooltipType: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
}
|
||||
|
||||
private val shapes = getShapeForEachStateMattery {
|
||||
Shapes.joinUnoptimized(CableBlock.getShapeFor(it, 0.185), BlockShapes.STORAGE_IMPORTER.rotateFromNorth(it[rotationProperty]).computeShape(), BooleanOp.OR)
|
||||
}
|
||||
@ -105,6 +98,10 @@ class StorageImporterBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES),
|
||||
}
|
||||
|
||||
class StorageExporterBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.blockEntityEnergy()
|
||||
}
|
||||
|
||||
override fun rotationFreedom(): BlockRotationFreedom {
|
||||
return BlockRotationFreedom.DIRECTIONAL
|
||||
}
|
||||
@ -136,17 +133,6 @@ class StorageExporterBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES),
|
||||
)
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
tooltipType: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
}
|
||||
|
||||
override fun <T : BlockEntity?> getTicker(
|
||||
p_153212_: Level,
|
||||
p_153213_: BlockState,
|
||||
|
@ -24,6 +24,11 @@ import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class StoragePowerSupplierBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.colored(color)
|
||||
tooltips.blockEntityEnergy()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||
return StoragePowerSupplierBlockEntity(p_153215_, p_153216_)
|
||||
}
|
||||
@ -39,17 +44,6 @@ class StoragePowerSupplierBlock(val color: DyeColor?) : RotatableMatteryBlock(DE
|
||||
return BlockEntityTicker { _, _, _, tile -> if (tile is StoragePowerSupplierBlockEntity) tile.tick() }
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
tooltipType: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
}
|
||||
|
||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.STORAGE_POWER_SUPPLIER.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||
|
||||
@Suppress("override_deprecation")
|
||||
|
@ -15,6 +15,7 @@ import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.Shapes
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.AbstractPoweredFurnaceBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.PoweredBlastFurnaceBlockEntity
|
||||
@ -30,6 +31,13 @@ sealed class AbstractPoweredFurnaceBlock<T : AbstractPoweredFurnaceBlockEntity<*
|
||||
val factory: (BlockPos, BlockState) -> T,
|
||||
shape: BlockShape?
|
||||
) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.painted(color)
|
||||
addSimpleDescription()
|
||||
tooltips.doubleProcessing()
|
||||
tooltips.blockEntityEnergy()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): T {
|
||||
return factory(p_153215_, p_153216_)
|
||||
}
|
||||
|
@ -2,13 +2,11 @@ package ru.dbotthepony.mc.otm.block.tech
|
||||
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.util.StringRepresentable
|
||||
import net.minecraft.world.entity.LivingEntity
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.item.context.BlockPlaceContext
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.Level
|
||||
@ -26,12 +24,11 @@ import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.AndroidChargerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.AndroidChargerMiddleBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.AndroidChargerTopBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.core.gracefulBlockBreak
|
||||
@ -40,6 +37,11 @@ import ru.dbotthepony.mc.otm.oncePre
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class AndroidChargerBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of(Material.METAL).destroyTime(2.5f).explosionResistance(40f).requiresCorrectToolForDrops()), EntityBlock {
|
||||
init {
|
||||
tooltips.painted(color)
|
||||
addSimpleDescription()
|
||||
tooltips.blockEntityEnergy()
|
||||
}
|
||||
enum class Type : StringRepresentable {
|
||||
BASE,
|
||||
MIDDLE,
|
||||
@ -145,14 +147,6 @@ class AndroidChargerBlock(val color: DyeColor?) : RotatableMatteryBlock(Properti
|
||||
}
|
||||
}
|
||||
|
||||
override fun appendHoverText(itemStack: ItemStack, blockAccessor: BlockGetter?, components: MutableList<Component>, tooltipType: TooltipFlag) {
|
||||
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
|
||||
components.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.GRAY))
|
||||
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
}
|
||||
|
||||
private val shapes = getShapeForEachState(listOf(rotationProperty, PART)) {
|
||||
val shape = when (it[PART]!!) {
|
||||
Type.BASE -> BlockShapes.ANDROID_CHARGER_BASE
|
||||
|
@ -1,13 +1,10 @@
|
||||
package ru.dbotthepony.mc.otm.block.tech
|
||||
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.InteractionHand
|
||||
import net.minecraft.world.InteractionResult
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.block.Block
|
||||
@ -21,16 +18,21 @@ import net.minecraft.world.phys.BlockHitResult
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.MatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.AndroidStationBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
||||
import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage
|
||||
import ru.dbotthepony.mc.otm.core.orNull
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class AndroidStationBlock(val color: DyeColor?) : MatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.painted(color)
|
||||
addSimpleDescription()
|
||||
tooltips.blockEntityEnergy()
|
||||
}
|
||||
|
||||
override fun use(
|
||||
blockState: BlockState,
|
||||
level: Level,
|
||||
@ -52,17 +54,6 @@ class AndroidStationBlock(val color: DyeColor?) : MatteryBlock(DEFAULT_MACHINE_P
|
||||
builder.add(WorkerState.SEMI_WORKER_STATE)
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
tooltipType: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
}
|
||||
|
||||
override fun getShape(
|
||||
p_151964_: BlockState,
|
||||
p_151965_: BlockGetter,
|
||||
|
@ -1,32 +1,31 @@
|
||||
package ru.dbotthepony.mc.otm.block.tech
|
||||
|
||||
import com.google.common.collect.ImmutableList
|
||||
import net.minecraft.MethodsReturnNonnullByDefault
|
||||
import javax.annotation.ParametersAreNonnullByDefault
|
||||
import net.minecraft.world.level.block.EntityBlock
|
||||
import net.minecraft.world.item.context.BlockPlaceContext
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty
|
||||
import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.BatteryBankBlockEntity
|
||||
import net.minecraft.world.item.context.BlockPlaceContext
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.EntityBlock
|
||||
import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.BatteryBankBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.oncePre
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class BatteryBankBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.painted(color)
|
||||
addSimpleDescription()
|
||||
}
|
||||
|
||||
override fun <T : BlockEntity> getTicker(
|
||||
level: Level,
|
||||
p_153213_: BlockState,
|
||||
|
@ -1,10 +1,7 @@
|
||||
package ru.dbotthepony.mc.otm.block.tech
|
||||
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.block.Block
|
||||
@ -17,15 +14,21 @@ import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.ChemicalGeneratorBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
import ru.dbotthepony.mc.otm.capability.energy.GeneratorEnergyStorage
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class ChemicalGeneratorBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.painted(color)
|
||||
addSimpleDescription()
|
||||
tooltips.blockEntityEnergy()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||
return ChemicalGeneratorBlockEntity(p_153215_, p_153216_)
|
||||
}
|
||||
@ -46,16 +49,6 @@ class ChemicalGeneratorBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAU
|
||||
builder.add(WorkerState.SEMI_WORKER_STATE)
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
tooltips: MutableList<Component>,
|
||||
tooltipType: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(itemStack, blockAccessor, tooltips, tooltipType)
|
||||
GeneratorEnergyStorage.appendHoverText(itemStack, blockAccessor, tooltips, tooltipType)
|
||||
}
|
||||
|
||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.CHEMICAL_GENERATOR.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||
|
||||
@Suppress("override_deprecation")
|
||||
|
@ -17,7 +17,6 @@ import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.CobblerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.core.needsNoPowerDescription
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class CobblerBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)), EntityBlock {
|
||||
@ -38,7 +37,8 @@ class CobblerBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of(M
|
||||
}
|
||||
|
||||
init {
|
||||
needsNoPowerDescription()
|
||||
tooltips.needsNoPower()
|
||||
tooltips.painted(color)
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
|
@ -19,6 +19,7 @@ import net.minecraft.world.level.block.state.properties.EnumProperty
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.MatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.EnergyCounterBlockEntity
|
||||
import ru.dbotthepony.mc.otm.core.asSupplier
|
||||
import ru.dbotthepony.mc.otm.core.collect.SupplierMap
|
||||
@ -28,6 +29,14 @@ import java.util.concurrent.Callable
|
||||
import java.util.function.Supplier
|
||||
|
||||
class EnergyCounterBlock(val color: DyeColor?) : MatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||
init {
|
||||
tooltips.painted(color)
|
||||
addSimpleDescription()
|
||||
addSimpleDescription("2")
|
||||
addSimpleDescription("3")
|
||||
addSimpleDescription("4")
|
||||
}
|
||||
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
return EnergyCounterBlockEntity(blockPos, blockState)
|
||||
}
|
||||
@ -124,7 +133,7 @@ class EnergyCounterBlock(val color: DyeColor?) : MatteryBlock(DEFAULT_MACHINE_PR
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmField val INPUT_DIRECTION: EnumProperty<Direction> = EnumProperty.create("input", Direction::class.java)
|
||||
@JvmField val IF_DIRECTION: EnumProperty<Direction> = EnumProperty.create("if", Direction::class.java)
|
||||
val INPUT_DIRECTION: EnumProperty<Direction> = EnumProperty.create("input", Direction::class.java)
|
||||
val IF_DIRECTION: EnumProperty<Direction> = EnumProperty.create("if", Direction::class.java)
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,10 @@ import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class EnergyServoBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of(Material.METAL, DyeColor.BLUE).sound(SoundType.METAL).explosionResistance(12f).destroyTime(2f).requiresCorrectToolForDrops()), EntityBlock {
|
||||
init {
|
||||
tooltips.painted(color)
|
||||
addSimpleDescription()
|
||||
}
|
||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||
return EnergyServoBlockEntity(p_153215_, p_153216_)
|
||||
}
|
||||
@ -43,10 +47,6 @@ class EnergyServoBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.
|
||||
return null
|
||||
}
|
||||
|
||||
init {
|
||||
addSimpleDescription()
|
||||
}
|
||||
|
||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.ENERGY_SERVO.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||
|
||||
@Suppress("override_deprecation")
|
||||
|
@ -1,6 +1,8 @@
|
||||
package ru.dbotthepony.mc.otm.block.tech
|
||||
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.nbt.LongTag
|
||||
import net.minecraft.world.InteractionHand
|
||||
import net.minecraft.world.InteractionResult
|
||||
import net.minecraft.world.entity.player.Player
|
||||
@ -21,11 +23,28 @@ import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.EssenceStorageBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
import ru.dbotthepony.mc.otm.client.isShiftDown
|
||||
import ru.dbotthepony.mc.otm.client.minecraft
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.core.util.getLevelFromXp
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class EssenceStorageBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(60.0f)), EntityBlock {
|
||||
init {
|
||||
tooltips.painted(color)
|
||||
|
||||
addSimpleDescription()
|
||||
|
||||
tooltips.blockEntityData<LongTag>("experienceStored") { _, l, acceptor ->
|
||||
if (minecraft.window.isShiftDown) {
|
||||
acceptor(TranslatableComponent("otm.gui.experience", l.asLong).withStyle(ChatFormatting.GRAY))
|
||||
} else {
|
||||
acceptor(TranslatableComponent("otm.gui.experience_levels", getLevelFromXp(l.asLong)).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
|
||||
return EssenceStorageBlockEntity(pPos, pState)
|
||||
}
|
||||
@ -47,10 +66,6 @@ class EssenceStorageBlock(val color: DyeColor?) : RotatableMatteryBlock(Properti
|
||||
return super.use(blockState, level, blockPos, ply, hand, blockHitResult)
|
||||
}
|
||||
|
||||
init {
|
||||
addSimpleDescription()
|
||||
}
|
||||
|
||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
||||
return PushReaction.BLOCK
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
|
||||
import ru.dbotthepony.mc.otm.core.math.plus
|
||||
import ru.dbotthepony.mc.otm.core.math.times
|
||||
import ru.dbotthepony.mc.otm.core.needsNoPowerDescription
|
||||
import ru.dbotthepony.mc.otm.core.runInBackground
|
||||
import ru.dbotthepony.mc.otm.oncePre
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
@ -45,6 +44,13 @@ import kotlin.math.PI
|
||||
private val props = BlockBehaviour.Properties.of(Material.METAL, DyeColor.BLUE).sound(SoundType.METAL).requiresCorrectToolForDrops().strength(3f, 600.0f)
|
||||
|
||||
class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock {
|
||||
init {
|
||||
addSimpleDescription()
|
||||
tooltips.needsNoPower(ChatFormatting.DARK_GRAY)
|
||||
addSimpleDescription("2", ChatFormatting.DARK_GRAY)
|
||||
addSimpleDescription("3", ChatFormatting.DARK_GRAY)
|
||||
}
|
||||
|
||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||
return GravitationStabilizerBlockEntity(p_153215_, p_153216_)
|
||||
}
|
||||
@ -150,13 +156,6 @@ class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock {
|
||||
return shapes[p_60555_[BlockRotationFreedom.DIRECTIONAL].ordinal]
|
||||
}
|
||||
|
||||
init {
|
||||
addSimpleDescription()
|
||||
needsNoPowerDescription(ChatFormatting.DARK_GRAY)
|
||||
addSimpleDescription("2", ChatFormatting.DARK_GRAY)
|
||||
addSimpleDescription("3", ChatFormatting.DARK_GRAY)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val shapes = SupplierList.ofFuture(
|
||||
runInBackground { BlockShapes.GRAVITATION_STABILIZER.rotateAroundX(PI / 2).computeShape() },
|
||||
|
@ -34,12 +34,15 @@ import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.core.math.minus
|
||||
import ru.dbotthepony.mc.otm.core.math.plus
|
||||
import ru.dbotthepony.mc.otm.core.needsNoPowerDescription
|
||||
import ru.dbotthepony.mc.otm.once
|
||||
import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class PhantomAttractorBlock : RotatableMatteryBlock(Properties.of(Material.METAL, DyeColor.BLUE).sound(SoundType.METAL).destroyTime(3f).explosionResistance(12f).randomTicks()) {
|
||||
init {
|
||||
addSimpleDescription()
|
||||
tooltips.needsNoPower()
|
||||
}
|
||||
@Suppress("OVERRIDE_DEPRECATION")
|
||||
override fun randomTick(
|
||||
blockState: BlockState,
|
||||
@ -147,9 +150,4 @@ class PhantomAttractorBlock : RotatableMatteryBlock(Properties.of(Material.METAL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
addSimpleDescription()
|
||||
needsNoPowerDescription()
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
package ru.dbotthepony.mc.otm.block.tech
|
||||
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.block.Block
|
||||
@ -19,14 +16,19 @@ import net.minecraft.world.level.material.PushReaction
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryWorkerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.PlatePressBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.PlatePressBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class PlatePressBlock(val color: DyeColor?, val isTwin: Boolean = false) : RotatableMatteryBlock(Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)), EntityBlock {
|
||||
init {
|
||||
tooltips.colored(color)
|
||||
if (isTwin) tooltips.doubleProcessing()
|
||||
tooltips.blockEntityEnergy()
|
||||
}
|
||||
|
||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||
return PlatePressBlockEntity(p_153215_, p_153216_, isTwin)
|
||||
}
|
||||
@ -51,16 +53,6 @@ class PlatePressBlock(val color: DyeColor?, val isTwin: Boolean = false) : Rotat
|
||||
return PushReaction.BLOCK
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
tooltipType: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
MatteryWorkerBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||
}
|
||||
|
||||
private val shapes = getShapeForEachState(rotationProperty) { (if (isTwin) BlockShapes.TWIN_PLATE_PRESS_IDLE else BlockShapes.PLATE_PRESS_IDLE).rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||
|
||||
@Suppress("override_deprecation")
|
||||
|
@ -289,13 +289,13 @@ fun moveEnergy(source: IEnergyStorage, destination: IEnergyStorage, amount: Deci
|
||||
return Decimal.ZERO
|
||||
}
|
||||
|
||||
internal fun IFluidHandler.fluidLevel(tooltips: MutableList<Component>) {
|
||||
internal fun IFluidHandler.fluidLevel(tooltips: (Component) -> Unit) {
|
||||
val fluid = getFluidInTank(0)
|
||||
|
||||
if (fluid.isEmpty) {
|
||||
tooltips.add(formatFluidLevel(0, getTankCapacity(0), formatAsReadable = ShiftPressedCond).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(formatFluidLevel(0, getTankCapacity(0), formatAsReadable = ShiftPressedCond).withStyle(ChatFormatting.GRAY))
|
||||
} else {
|
||||
tooltips.add(formatFluidLevel(fluid.amount, getTankCapacity(0), fluid.displayName, formatAsReadable = ShiftPressedCond).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(formatFluidLevel(fluid.amount, getTankCapacity(0), fluid.displayName, formatAsReadable = ShiftPressedCond).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,72 +93,72 @@ interface IMatteryUpgrade {
|
||||
private val positiveBound = Decimal("0.01")
|
||||
private val negativeBound = Decimal("-0.01")
|
||||
|
||||
fun IMatteryUpgrade.addUpgradeTooltipLines(tooltips: MutableCollection<Component>) {
|
||||
fun IMatteryUpgrade.addUpgradeTooltipLines(tooltips: (Component) -> Unit) {
|
||||
if (upgradeTypes.isNotEmpty() && ShiftPressedCond.asBoolean) {
|
||||
tooltips.add(TranslatableComponent("otm.gui.upgrade_type.list").withStyle(ChatFormatting.GRAY))
|
||||
tooltips(TranslatableComponent("otm.gui.upgrade_type.list").withStyle(ChatFormatting.GRAY))
|
||||
|
||||
for (upgrade in upgradeTypes) {
|
||||
tooltips.add(upgrade.component.copy().withStyle(ChatFormatting.GRAY))
|
||||
tooltips(upgrade.component.copy().withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
tooltips.add(TextComponent(""))
|
||||
tooltips(TextComponent(""))
|
||||
}
|
||||
|
||||
val actualSpeedBonus = speedBonus.coerceIn(MachinesConfig.Upgrades.MIN_SPEED, MachinesConfig.Upgrades.MAX_SPEED)
|
||||
val speedBonusLimit = if (actualSpeedBonus == MachinesConfig.Upgrades.MIN_SPEED || actualSpeedBonus == MachinesConfig.Upgrades.MAX_SPEED) "_limit" else ""
|
||||
|
||||
if (speedBonus >= 0.01) {
|
||||
tooltips.add(TranslatableComponent("otm.gui.upgrade.speed$speedBonusLimit", TextComponent("+" + (actualSpeedBonus * 100.0).toInt().toString()).withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(TranslatableComponent("otm.gui.upgrade.speed$speedBonusLimit", TextComponent("+" + (actualSpeedBonus * 100.0).toInt().toString()).withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
} else if (speedBonus <= -0.01) {
|
||||
tooltips.add(TranslatableComponent("otm.gui.upgrade.speed$speedBonusLimit", TextComponent((actualSpeedBonus * 100.0).toInt().toString()).withStyle(ChatFormatting.DARK_RED)).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(TranslatableComponent("otm.gui.upgrade.speed$speedBonusLimit", TextComponent((actualSpeedBonus * 100.0).toInt().toString()).withStyle(ChatFormatting.DARK_RED)).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
if (processingItems != 0) {
|
||||
tooltips.add(TranslatableComponent("otm.gui.upgrade.processing_items", TextComponent(processingItems.toString()).withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(TranslatableComponent("otm.gui.upgrade.processing_items", TextComponent(processingItems.toString()).withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
if (energyStorageFlat != Decimal.ZERO) {
|
||||
tooltips.add(TranslatableComponent("otm.gui.upgrade.energy_storage_flat", energyStorageFlat.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(TranslatableComponent("otm.gui.upgrade.energy_storage_flat", energyStorageFlat.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
if (energyStorage != Decimal.ZERO) {
|
||||
tooltips.add(TranslatableComponent("otm.gui.upgrade.energy_storage", TextComponent((energyStorage * 100).toString(0)).withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(TranslatableComponent("otm.gui.upgrade.energy_storage", TextComponent((energyStorage * 100).toString(0)).withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
if (matterStorageFlat != Decimal.ZERO) {
|
||||
tooltips.add(TranslatableComponent("otm.gui.upgrade.matter_storage_flat", matterStorageFlat.formatMatter(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(TranslatableComponent("otm.gui.upgrade.matter_storage_flat", matterStorageFlat.formatMatter(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
if (matterStorage != Decimal.ZERO) {
|
||||
tooltips.add(TranslatableComponent("otm.gui.upgrade.matter_storage", TextComponent((matterStorage * 100).toString(0)).withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(TranslatableComponent("otm.gui.upgrade.matter_storage", TextComponent((matterStorage * 100).toString(0)).withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
val actualEnergyConsumed = energyConsumed.coerceIn(MachinesConfig.Upgrades.MIN_ENERGY, MachinesConfig.Upgrades.MAX_ENERGY)
|
||||
val consumedLimit = if (actualEnergyConsumed == MachinesConfig.Upgrades.MIN_ENERGY || actualEnergyConsumed == MachinesConfig.Upgrades.MAX_ENERGY) "_limit" else ""
|
||||
|
||||
if (energyConsumed >= positiveBound) {
|
||||
tooltips.add(TranslatableComponent("otm.gui.upgrade.energy_consumed$consumedLimit", TextComponent("+" + (actualEnergyConsumed * 100).toString(0)).withStyle(ChatFormatting.DARK_RED)).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(TranslatableComponent("otm.gui.upgrade.energy_consumed$consumedLimit", TextComponent("+" + (actualEnergyConsumed * 100).toString(0)).withStyle(ChatFormatting.DARK_RED)).withStyle(ChatFormatting.GRAY))
|
||||
} else if (energyConsumed <= negativeBound) {
|
||||
tooltips.add(TranslatableComponent("otm.gui.upgrade.energy_consumed$consumedLimit", TextComponent((actualEnergyConsumed * 100).toString(0)).withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(TranslatableComponent("otm.gui.upgrade.energy_consumed$consumedLimit", TextComponent((actualEnergyConsumed * 100).toString(0)).withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
if (energyThroughputFlat != Decimal.ZERO) {
|
||||
tooltips.add(TranslatableComponent("otm.gui.upgrade.energy_throughput_flat", energyThroughputFlat.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(TranslatableComponent("otm.gui.upgrade.energy_throughput_flat", energyThroughputFlat.formatPower(formatAsReadable = ShiftPressedCond).copy().withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
if (energyThroughput != Decimal.ZERO) {
|
||||
tooltips.add(TranslatableComponent("otm.gui.upgrade.energy_throughput", TextComponent((energyThroughput * 100).toString(0)).withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(TranslatableComponent("otm.gui.upgrade.energy_throughput", TextComponent((energyThroughput * 100).toString(0)).withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
if (failureMultiplier >= 1.01) {
|
||||
tooltips.add(TranslatableComponent("otm.gui.upgrade.failsafe", TextComponent("+" + ((failureMultiplier - 1) * 100).toInt().toString()).withStyle(ChatFormatting.DARK_RED)).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(TranslatableComponent("otm.gui.upgrade.failsafe", TextComponent("+" + ((failureMultiplier - 1) * 100).toInt().toString()).withStyle(ChatFormatting.DARK_RED)).withStyle(ChatFormatting.GRAY))
|
||||
} else if (failureMultiplier <= 0.99) {
|
||||
tooltips.add(TranslatableComponent("otm.gui.upgrade.failsafe", TextComponent(((failureMultiplier.coerceAtLeast(0.0) - 1) * 100).toInt().toString()).withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
tooltips(TranslatableComponent("otm.gui.upgrade.failsafe", TextComponent(((failureMultiplier.coerceAtLeast(0.0) - 1) * 100).toInt().toString()).withStyle(ChatFormatting.DARK_GREEN)).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
}
|
||||
|
||||
fun IMatteryUpgrade.getUpgradeTooltipLines(): MutableList<Component> {
|
||||
return ArrayList<Component>().also { addUpgradeTooltipLines(it) }
|
||||
return ArrayList<Component>().also { addUpgradeTooltipLines(it::add) }
|
||||
}
|
||||
|
||||
interface ITieredUpgradeSet {
|
||||
|
@ -4,21 +4,12 @@
|
||||
package ru.dbotthepony.mc.otm.capability.energy
|
||||
|
||||
import net.minecraft.nbt.CompoundTag
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.item.BlockItem
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import net.minecraftforge.common.ForgeConfigSpec
|
||||
import net.minecraftforge.common.util.INBTSerializable
|
||||
import net.minecraftforge.common.util.LazyOptional
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
||||
import ru.dbotthepony.mc.otm.capability.FlowDirection
|
||||
import ru.dbotthepony.mc.otm.config.EnergyBalanceValues
|
||||
import ru.dbotthepony.mc.otm.config.VerboseEnergyBalanceValues
|
||||
import ru.dbotthepony.mc.otm.capability.FlowDirection
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.core.math.defineDecimal
|
||||
import ru.dbotthepony.mc.otm.core.nbt.mapPresent
|
||||
import ru.dbotthepony.mc.otm.core.nbt.set
|
||||
|
||||
@ -158,19 +149,6 @@ open class WorkerEnergyStorage(
|
||||
listener: () -> Unit,
|
||||
values: VerboseEnergyBalanceValues
|
||||
) : this(listener, values::energyCapacity, values::maxEnergyReceive, values::maxEnergyExtract)
|
||||
|
||||
companion object {
|
||||
fun appendHoverText(itemStack: ItemStack, tooltips: MutableList<Component>) {
|
||||
val tag = (itemStack.tag?.get(BlockItem.BLOCK_ENTITY_TAG) as? CompoundTag)?.get(MatteryBlockEntity.ENERGY_KEY) as? CompoundTag ?: return
|
||||
val cap = WorkerEnergyStorage({}, { DEFAULT_MAX_CAPACITY })
|
||||
cap.deserializeNBT(tag)
|
||||
batteryLevel(cap, tooltips, false)
|
||||
}
|
||||
|
||||
fun appendHoverText(itemStack: ItemStack, blockGetter: BlockGetter?, tooltips: MutableList<Component>, flag: TooltipFlag) {
|
||||
return appendHoverText(itemStack, tooltips)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class GeneratorEnergyStorage(
|
||||
@ -188,19 +166,6 @@ open class GeneratorEnergyStorage(
|
||||
listener: () -> Unit,
|
||||
values: VerboseEnergyBalanceValues
|
||||
) : this(listener, values::energyCapacity, values::maxEnergyReceive, values::maxEnergyExtract)
|
||||
|
||||
companion object {
|
||||
fun appendHoverText(itemStack: ItemStack, tooltips: MutableList<Component>) {
|
||||
val tag = (itemStack.tag?.get(BlockItem.BLOCK_ENTITY_TAG) as? CompoundTag)?.get(MatteryBlockEntity.ENERGY_KEY) as? CompoundTag ?: return
|
||||
val cap = GeneratorEnergyStorage({}, { DEFAULT_MAX_CAPACITY })
|
||||
cap.deserializeNBT(tag)
|
||||
batteryLevel(cap, tooltips)
|
||||
}
|
||||
|
||||
fun appendHoverText(itemStack: ItemStack, blockGetter: BlockGetter?, tooltips: MutableList<Component>, flag: TooltipFlag) {
|
||||
return appendHoverText(itemStack, tooltips)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class CapacitorEnergyStorage(
|
||||
@ -218,17 +183,4 @@ open class CapacitorEnergyStorage(
|
||||
listener: () -> Unit,
|
||||
values: VerboseEnergyBalanceValues
|
||||
) : this(listener, values::energyCapacity, values::maxEnergyReceive, values::maxEnergyExtract)
|
||||
|
||||
companion object {
|
||||
fun appendHoverText(itemStack: ItemStack, tooltips: MutableList<Component>) {
|
||||
val tag = (itemStack.tag?.get(BlockItem.BLOCK_ENTITY_TAG) as? CompoundTag)?.get(MatteryBlockEntity.ENERGY_KEY) as? CompoundTag ?: return
|
||||
val cap = CapacitorEnergyStorage({}, { DEFAULT_MAX_CAPACITY })
|
||||
cap.deserializeNBT(tag)
|
||||
batteryLevel(cap, tooltips)
|
||||
}
|
||||
|
||||
fun appendHoverText(itemStack: ItemStack, blockGetter: BlockGetter?, tooltips: MutableList<Component>, flag: TooltipFlag) {
|
||||
return appendHoverText(itemStack, tooltips)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ sealed interface IEnergyStorageImpl {
|
||||
val maxOutput: Decimal?
|
||||
}
|
||||
|
||||
internal fun batteryLevel(it: IEnergyStorage, tooltips: MutableList<Component>) {
|
||||
tooltips.add(
|
||||
internal fun batteryLevel(it: IEnergyStorage, tooltips: (Component) -> Unit) {
|
||||
tooltips(
|
||||
TranslatableComponent(
|
||||
"otm.item.power.storage",
|
||||
it.energyStored.formatPower(formatAsReadable = ShiftPressedCond),
|
||||
@ -23,16 +23,16 @@ internal fun batteryLevel(it: IEnergyStorage, tooltips: MutableList<Component>)
|
||||
).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
internal fun batteryLevel(it: IMatteryEnergyStorage, tooltips: MutableList<Component>, displayMaxLevel: Boolean = true) {
|
||||
internal fun batteryLevel(it: IMatteryEnergyStorage, tooltips: (Component) -> Unit, displayMaxLevel: Boolean = true) {
|
||||
if (displayMaxLevel)
|
||||
tooltips.add(
|
||||
tooltips(
|
||||
TranslatableComponent(
|
||||
"otm.item.power.storage",
|
||||
it.batteryLevel.formatPower(formatAsReadable = ShiftPressedCond),
|
||||
it.maxBatteryLevel.formatPower(formatAsReadable = ShiftPressedCond)
|
||||
).withStyle(ChatFormatting.GRAY))
|
||||
else
|
||||
tooltips.add(
|
||||
tooltips(
|
||||
TranslatableComponent(
|
||||
"otm.item.power.storage0",
|
||||
it.batteryLevel.formatPower(formatAsReadable = ShiftPressedCond)
|
||||
@ -41,68 +41,20 @@ internal fun batteryLevel(it: IMatteryEnergyStorage, tooltips: MutableList<Compo
|
||||
if (it is IEnergyStorageImpl) {
|
||||
when (it.energyFlow) {
|
||||
FlowDirection.INPUT -> {
|
||||
if (it.maxInput != null) {
|
||||
tooltips.add(
|
||||
TranslatableComponent("otm.item.power.throughput_mono", it.maxInput!!.formatPower(formatAsReadable = ShiftPressedCond)).withStyle(
|
||||
ChatFormatting.GRAY
|
||||
))
|
||||
} else {
|
||||
tooltips.add(
|
||||
TranslatableComponent(
|
||||
"otm.item.power.throughput_mono",
|
||||
TranslatableComponent("otm.item.power.infinity").withStyle(ChatFormatting.GRAY)
|
||||
).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
tooltips(TranslatableComponent("otm.item.power.throughput_mono", (it.maxInput ?: Decimal.POSITIVE_INFINITY).formatPower(formatAsReadable = ShiftPressedCond)).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
FlowDirection.OUTPUT -> {
|
||||
if (it.maxOutput != null) {
|
||||
tooltips.add(
|
||||
TranslatableComponent("otm.item.power.throughput_mono", it.maxOutput!!.formatPower(formatAsReadable = ShiftPressedCond)).withStyle(
|
||||
ChatFormatting.GRAY
|
||||
))
|
||||
} else {
|
||||
tooltips.add(
|
||||
TranslatableComponent(
|
||||
"otm.item.power.throughput_mono",
|
||||
TranslatableComponent("otm.item.power.infinity").withStyle(ChatFormatting.GRAY)
|
||||
).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
tooltips(TranslatableComponent("otm.item.power.throughput_mono", (it.maxOutput ?: Decimal.POSITIVE_INFINITY).formatPower(formatAsReadable = ShiftPressedCond)).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
FlowDirection.BI_DIRECTIONAL -> {
|
||||
val maxInput = it.maxInput
|
||||
val maxOutput = it.maxOutput
|
||||
|
||||
if (maxInput != null && maxOutput != null) {
|
||||
tooltips.add(
|
||||
TranslatableComponent(
|
||||
"otm.item.power.throughput",
|
||||
maxInput.formatPower(formatAsReadable = ShiftPressedCond),
|
||||
maxOutput.formatPower(formatAsReadable = ShiftPressedCond)
|
||||
).withStyle(ChatFormatting.GRAY))
|
||||
} else if (maxInput != null) {
|
||||
tooltips.add(
|
||||
TranslatableComponent(
|
||||
"otm.item.power.throughput",
|
||||
maxInput.formatPower(formatAsReadable = ShiftPressedCond),
|
||||
TranslatableComponent("otm.item.power.infinity").withStyle(ChatFormatting.GRAY)
|
||||
).withStyle(ChatFormatting.GRAY))
|
||||
} else if (maxOutput != null) {
|
||||
tooltips.add(
|
||||
TranslatableComponent(
|
||||
"otm.item.power.throughput",
|
||||
TranslatableComponent("otm.item.power.infinity").withStyle(ChatFormatting.GRAY),
|
||||
maxOutput.formatPower(formatAsReadable = ShiftPressedCond),
|
||||
).withStyle(ChatFormatting.GRAY))
|
||||
} else {
|
||||
tooltips.add(
|
||||
TranslatableComponent(
|
||||
"otm.item.power.throughput",
|
||||
TranslatableComponent("otm.item.power.infinity").withStyle(ChatFormatting.GRAY),
|
||||
TranslatableComponent("otm.item.power.infinity").withStyle(ChatFormatting.GRAY),
|
||||
).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
tooltips(
|
||||
TranslatableComponent(
|
||||
"otm.item.power.throughput",
|
||||
(it.maxInput ?: Decimal.POSITIVE_INFINITY).formatPower(formatAsReadable = ShiftPressedCond),
|
||||
(it.maxOutput ?: Decimal.POSITIVE_INFINITY).formatPower(formatAsReadable = ShiftPressedCond)
|
||||
).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
FlowDirection.NONE -> {}
|
||||
|
@ -12,6 +12,7 @@ import net.minecraftforge.common.util.LazyOptional
|
||||
import ru.dbotthepony.mc.otm.capability.FlowDirection
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
||||
import ru.dbotthepony.mc.otm.capability.energy
|
||||
import ru.dbotthepony.mc.otm.core.TooltipList
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.core.nbt.map
|
||||
import ru.dbotthepony.mc.otm.core.nbt.set
|
||||
@ -73,20 +74,6 @@ abstract class ItemEnergyStorageImpl(val itemStack: ItemStack) : IMatteryEnergyS
|
||||
|
||||
companion object {
|
||||
const val ENERGY_KEY = "energy"
|
||||
|
||||
fun appendHoverText(itemStack: ItemStack, level: Level?, tooltips: MutableList<Component>, flag: TooltipFlag) {
|
||||
appendHoverText(itemStack, tooltips)
|
||||
}
|
||||
|
||||
fun appendHoverText(itemStack: ItemStack, tooltips: MutableList<Component>) {
|
||||
val energy = itemStack.energy ?: return
|
||||
|
||||
if (energy is IMatteryEnergyStorage) {
|
||||
batteryLevel(energy, tooltips)
|
||||
} else {
|
||||
batteryLevel(energy, tooltips)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import ru.dbotthepony.mc.otm.capability.FlowDirection
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.core.nbt.set
|
||||
|
||||
open class MatterStorageImpl @JvmOverloads constructor(
|
||||
open class MatterStorageImpl(
|
||||
protected val listener: Runnable?,
|
||||
override val matterFlow: FlowDirection,
|
||||
protected val maxStoredMatterSupplier: () -> Decimal,
|
||||
@ -93,7 +93,7 @@ open class MatterStorageImpl @JvmOverloads constructor(
|
||||
|
||||
override fun serializeNBT(): CompoundTag {
|
||||
return CompoundTag().also {
|
||||
it["stored"] = storedMatter.serializeNBT()
|
||||
it[MATTER_STORED_KEY] = storedMatter.serializeNBT()
|
||||
//it["max_storage"] = maxStoredMatter.serializeNBT()
|
||||
//if (maxReceive != null) it["max_receive"] = maxReceive.serializeNBT()
|
||||
//if (maxExtract != null) it["max_extract"] = maxExtract.serializeNBT()
|
||||
@ -102,9 +102,13 @@ open class MatterStorageImpl @JvmOverloads constructor(
|
||||
|
||||
override fun deserializeNBT(tag: CompoundTag?) {
|
||||
if (tag == null) return
|
||||
storedMatter = Decimal.deserializeNBT(tag["stored"])
|
||||
storedMatter = Decimal.deserializeNBT(tag[MATTER_STORED_KEY])
|
||||
//maxStoredMatter = ImpreciseFraction.deserializeNBT(tag["max_storage"])
|
||||
//maxReceive = if (tag.contains("max_receive")) ImpreciseFraction.deserializeNBT(tag["max_receive"]) else null
|
||||
//maxExtract = if (tag.contains("max_extract")) ImpreciseFraction.deserializeNBT(tag["max_extract"]) else null
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val MATTER_STORED_KEY = "stored"
|
||||
}
|
||||
}
|
||||
|
@ -292,9 +292,15 @@ fun drawLine(
|
||||
tess.end()
|
||||
}
|
||||
|
||||
data class ScissorRect(val x: Int, val y: Int, val width: Int, val height: Int, val lock: Boolean = false) {
|
||||
data class ScissorRect(val xStart: Int, val yStart: Int, val xEnd: Int, val yEnd: Int, val lock: Boolean = false) {
|
||||
val width: Int
|
||||
get() = (xEnd - xStart).coerceAtLeast(0)
|
||||
|
||||
val height: Int
|
||||
get() = (yEnd - yStart).coerceAtLeast(0)
|
||||
|
||||
fun withinBounds(x: Int, y: Int): Boolean {
|
||||
return (x in this.x .. this.x + width) && (y in this.y .. this.y + height)
|
||||
return (x in this.xStart .. xEnd) && (y in this.yStart .. yEnd)
|
||||
}
|
||||
|
||||
fun cross(x: Int, y: Int, width: Int, height: Int): Boolean {
|
||||
@ -304,18 +310,18 @@ data class ScissorRect(val x: Int, val y: Int, val width: Int, val height: Int,
|
||||
}
|
||||
|
||||
// crossing at least one line
|
||||
if (y in this.y .. this.y + height) {
|
||||
if (x < this.x && x + width > this.x + this.width) {
|
||||
if (y in this.yStart .. this.yStart + height) {
|
||||
if (x < this.xStart && x + width > this.xEnd) {
|
||||
return true
|
||||
}
|
||||
} else if (x in this.x .. this.x + width) {
|
||||
if (y < this.y && y + height > this.y + this.height) {
|
||||
} else if (x in this.xStart .. this.xStart + width) {
|
||||
if (y < this.yStart && y + height > this.yEnd) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// final test: check if scissor rect is completely inside provided rect
|
||||
return this.x in x .. x + width && this.y in y .. y + height
|
||||
return this.xStart in x .. x + width && this.yStart in y .. y + height
|
||||
}
|
||||
|
||||
fun crossScaled(x: Float, y: Float, width: Float, height: Float): Boolean {
|
||||
@ -327,17 +333,20 @@ data class ScissorRect(val x: Int, val y: Int, val width: Int, val height: Int,
|
||||
val scale = minecraft.window.guiScale
|
||||
return cross((x * scale).roundToInt(), (y * scale).roundToInt(), (width * scale).roundToInt(), (height * scale).roundToInt())
|
||||
}
|
||||
|
||||
fun apply() {
|
||||
RenderSystem.enableScissor(xStart, minecraft.window.height - yStart - height, width, height)
|
||||
}
|
||||
}
|
||||
|
||||
private val scissorStack = ArrayDeque<ScissorRect>()
|
||||
|
||||
@Suppress("NAME_SHADOWING")
|
||||
@JvmOverloads
|
||||
fun pushScissorRect(x: Int, y: Int, width: Int, height: Int, lock: Boolean = false) {
|
||||
var x = x
|
||||
var y = y
|
||||
var width = width
|
||||
var height = height
|
||||
var xStart = x
|
||||
var yStart = y
|
||||
var xEnd = x + width
|
||||
var yEnd = y + height
|
||||
|
||||
val peek = scissorStack.lastOrNull()
|
||||
|
||||
@ -347,34 +356,31 @@ fun pushScissorRect(x: Int, y: Int, width: Int, height: Int, lock: Boolean = fal
|
||||
return
|
||||
}
|
||||
|
||||
x = x.coerceAtLeast(peek.x)
|
||||
y = y.coerceAtLeast(peek.y)
|
||||
width = width.coerceAtMost(peek.width)
|
||||
height = height.coerceAtMost(peek.height)
|
||||
xStart = xStart.coerceAtLeast(peek.xStart)
|
||||
yStart = yStart.coerceAtLeast(peek.yStart)
|
||||
xEnd = xEnd.coerceAtMost(peek.xEnd)
|
||||
yEnd = yEnd.coerceAtMost(peek.yEnd)
|
||||
|
||||
if (peek.x == x && peek.y == y && peek.width == width && peek.height == height) {
|
||||
if (peek.xStart == xStart && peek.yStart == yStart && peek.xEnd == xEnd && peek.yEnd == yEnd) {
|
||||
scissorStack.add(peek)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
scissorStack.add(ScissorRect(x, y, width, height, lock))
|
||||
y = minecraft.window.height - y - height
|
||||
RenderSystem.enableScissor(x, y, width, height)
|
||||
val new = ScissorRect(xStart, yStart, xEnd, yEnd, lock)
|
||||
scissorStack.add(new)
|
||||
new.apply()
|
||||
}
|
||||
|
||||
fun popScissorRect() {
|
||||
scissorStack.removeLast()
|
||||
|
||||
val peek = scissorStack.lastOrNull()
|
||||
|
||||
if (peek == null) {
|
||||
RenderSystem.disableScissor()
|
||||
return
|
||||
} else {
|
||||
peek.apply()
|
||||
}
|
||||
|
||||
val y = minecraft.window.height - peek.y - peek.height
|
||||
RenderSystem.enableScissor(peek.x, y, peek.width, peek.height)
|
||||
}
|
||||
|
||||
val currentScissorRect get() = scissorStack.lastOrNull()
|
||||
|
@ -215,6 +215,12 @@ open class EditablePanel<out S : Screen>(
|
||||
parent?.boundsInvalidated = true
|
||||
}
|
||||
|
||||
val effectiveWidth: Float
|
||||
get() = width - dockPadding.horizontal
|
||||
|
||||
val effectiveHeight: Float
|
||||
get() = height - dockPadding.vertical
|
||||
|
||||
/**
|
||||
* Width of this panel as considered by docking code, updated inside [performLayout]
|
||||
*
|
||||
@ -1129,7 +1135,7 @@ open class EditablePanel<out S : Screen>(
|
||||
if (child.dockResize.changeHeight)
|
||||
child.height = child.dockedHeight
|
||||
else if (child.height != child.dockedHeight)
|
||||
child.y += child.dockedHeight / 2f - child.height / 2f
|
||||
child.y += (child.dockedHeight / 2f - child.height / 2f).roundToInt().toFloat()
|
||||
}
|
||||
|
||||
Dock.RIGHT -> {
|
||||
@ -1143,7 +1149,7 @@ open class EditablePanel<out S : Screen>(
|
||||
if (child.dockResize.changeHeight)
|
||||
child.height = child.dockedHeight
|
||||
else if (child.height != child.dockedHeight)
|
||||
child.y += child.dockedHeight / 2f - child.height / 2f
|
||||
child.y += (child.dockedHeight / 2f - child.height / 2f).roundToInt().toFloat()
|
||||
}
|
||||
|
||||
Dock.TOP -> {
|
||||
@ -1157,7 +1163,7 @@ open class EditablePanel<out S : Screen>(
|
||||
if (child.dockResize.changeWidth)
|
||||
child.width = child.dockedWidth
|
||||
else if (child.width != child.dockedWidth)
|
||||
child.x += child.dockedWidth / 2f - child.width / 2f
|
||||
child.x += (child.dockedWidth / 2f - child.width / 2f).roundToInt().toFloat()
|
||||
}
|
||||
|
||||
Dock.BOTTOM -> {
|
||||
@ -1171,7 +1177,7 @@ open class EditablePanel<out S : Screen>(
|
||||
if (child.dockResize.changeWidth)
|
||||
child.width = child.dockedWidth
|
||||
else if (child.width != child.dockedWidth)
|
||||
child.x += child.dockedWidth / 2f - child.width / 2f
|
||||
child.x += (child.dockedWidth / 2f - child.width / 2f).roundToInt().toFloat()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ class DeviceControls<out S : MatteryScreen<*>>(
|
||||
}
|
||||
|
||||
val i = it.size
|
||||
upgrades.currentStats.addUpgradeTooltipLines(it)
|
||||
upgrades.currentStats.addUpgradeTooltipLines(it::add)
|
||||
|
||||
if (it.size != i) {
|
||||
it.add(i, TranslatableComponent("otm.gui.upgrades.current").withStyle(ChatFormatting.GRAY))
|
||||
|
@ -19,8 +19,17 @@ open class BackgroundPanel<out S : Screen>(
|
||||
dockPadding = DockProperty(3f, 3f, 3f, 3f)
|
||||
}
|
||||
|
||||
var drawBackground = true
|
||||
|
||||
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||
RECTANGLE.render(graphics, width = width, height = height)
|
||||
if (drawBackground) {
|
||||
RECTANGLE.render(graphics, width = width, height = height)
|
||||
}
|
||||
}
|
||||
|
||||
fun removeBackground() {
|
||||
dockPadding = DockProperty.EMPTY
|
||||
drawBackground = false
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -0,0 +1,83 @@
|
||||
package ru.dbotthepony.mc.otm.client.screen.tech
|
||||
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.Dock
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.DockResizeMode
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.ScrollbarBackgroundPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.BatterySlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.WideProfiledPowerGaugePanel
|
||||
import ru.dbotthepony.mc.otm.compat.jei.isJeiLoaded
|
||||
import ru.dbotthepony.mc.otm.menu.tech.AbstractProcessingMachineMenu
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
open class AbstractProcessingMachineScreen<M : AbstractProcessingMachineMenu>(menu: M, inventory: Inventory, title: Component) : MatteryScreen<M>(menu, inventory, title) {
|
||||
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
WideProfiledPowerGaugePanel(this, frame, menu.profiledEnergy, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
val height = menu.processingTuples.size * (AbstractSlotPanel.SIZE + 2f) - 2f
|
||||
|
||||
val progressPanels = ArrayList<ProgressGaugePanel<*>>()
|
||||
|
||||
val parentTarget = if (height >= frame.effectiveHeight - 10f) {
|
||||
val parent = ScrollbarBackgroundPanel(this, frame)
|
||||
parent.removeBackground()
|
||||
parent.dock = Dock.FILL
|
||||
parent.dockLeft = 50f
|
||||
parent.dockRight = 4f
|
||||
parent.canvas
|
||||
} else {
|
||||
val parent = EditablePanel(this, frame)
|
||||
parent.dock = Dock.FILL
|
||||
frame.performLayout()
|
||||
parent.dockPaddingTop = ((parent.effectiveHeight - height) / 2f).roundToInt().toFloat()
|
||||
parent.dockLeft = 50f
|
||||
parent
|
||||
}
|
||||
|
||||
for ((input, output, progress) in menu.processingTuples) {
|
||||
val row = EditablePanel(this, parentTarget, height = AbstractSlotPanel.SIZE)
|
||||
row.dock = Dock.TOP
|
||||
row.dockBottom = 2f
|
||||
|
||||
SlotPanel(this, row, input).also {
|
||||
it.dock = Dock.LEFT
|
||||
}
|
||||
|
||||
progressPanels.add(ProgressGaugePanel(this, row, progress).also {
|
||||
it.dock = Dock.LEFT
|
||||
it.dockLeft = 4f
|
||||
it.dockRight = 4f
|
||||
it.dockResize = DockResizeMode.NONE
|
||||
})
|
||||
|
||||
SlotPanel(this, row, output).also {
|
||||
it.dock = Dock.LEFT
|
||||
}
|
||||
}
|
||||
|
||||
makeDeviceControls(this, frame, redstoneConfig = menu.redstoneConfig, energyConfig = menu.energyConfig, itemConfig = menu.itemConfig, balanceInputs = menu.balanceInputs, upgrades = menu.upgrades)
|
||||
|
||||
if (isJeiLoaded) {
|
||||
val recipeTypes = menu.recipeTypes
|
||||
|
||||
if (recipeTypes != null) {
|
||||
progressPanels.forEach {
|
||||
it.setRecipeType(recipeTypes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return frame
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package ru.dbotthepony.mc.otm.client.screen.tech
|
||||
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.BatterySlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.WideProfiledPowerGaugePanel
|
||||
import ru.dbotthepony.mc.otm.compat.jei.PlatePressRecipeCategory
|
||||
import ru.dbotthepony.mc.otm.menu.tech.PlatePressMenu
|
||||
|
||||
class PlatePressScreen(menu: PlatePressMenu, inventory: Inventory, title: Component) :
|
||||
MatteryScreen<PlatePressMenu>(menu, inventory, title) {
|
||||
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
WideProfiledPowerGaugePanel(this, frame, menu.profiledEnergy, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
SlotPanel(this, frame, menu.inputSlot, 56f, PROGRESS_SLOT_TOP)
|
||||
ProgressGaugePanel(this, frame, menu.progressGauge, 78f, PROGRESS_ARROW_TOP).setRecipeType { listOf(PlatePressRecipeCategory.recipeType) }
|
||||
SlotPanel(this, frame, menu.outputSlot, 104f, PROGRESS_SLOT_TOP)
|
||||
|
||||
makeDeviceControls(this, frame, redstoneConfig = menu.redstoneConfig, energyConfig = menu.energyConfig, itemConfig = menu.itemConfig, upgrades = menu.upgrades)
|
||||
|
||||
return frame
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package ru.dbotthepony.mc.otm.client.screen.tech
|
||||
|
||||
import mezz.jei.api.constants.RecipeTypes
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.BatterySlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.WideProfiledPowerGaugePanel
|
||||
import ru.dbotthepony.mc.otm.compat.jei.MicrowaveRecipeCategory
|
||||
import ru.dbotthepony.mc.otm.menu.tech.PoweredFurnaceMenu
|
||||
import ru.dbotthepony.mc.otm.registry.MMenus
|
||||
|
||||
class PoweredFurnaceScreen(menu: PoweredFurnaceMenu, inventory: Inventory, title: Component) :
|
||||
MatteryScreen<PoweredFurnaceMenu>(menu, inventory, title) {
|
||||
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
WideProfiledPowerGaugePanel(this, frame, menu.profiledEnergy, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
SlotPanel(this, frame, menu.inputSlots[0], 56f, PROGRESS_SLOT_TOP - 10f)
|
||||
val a = ProgressGaugePanel(this, frame, menu.progressGauge[0], 78f, PROGRESS_ARROW_TOP - 10f)
|
||||
SlotPanel(this, frame, menu.outputSlots[0], 104f, PROGRESS_SLOT_TOP - 10f)
|
||||
|
||||
SlotPanel(this, frame, menu.inputSlots[1], 56f, PROGRESS_SLOT_TOP + 10f)
|
||||
val b = ProgressGaugePanel(this, frame, menu.progressGauge[1], 78f, PROGRESS_ARROW_TOP + 10f)
|
||||
SlotPanel(this, frame, menu.outputSlots[1], 104f, PROGRESS_SLOT_TOP + 10f)
|
||||
|
||||
makeDeviceControls(this, frame, redstoneConfig = menu.redstoneConfig, energyConfig = menu.energyConfig, itemConfig = menu.itemConfig, balanceInputs = menu.balanceInputs, upgrades = menu.upgrades)
|
||||
|
||||
when (menu.type) {
|
||||
MMenus.POWERED_FURNACE -> {
|
||||
a.setRecipeType { listOf(RecipeTypes.SMELTING) }
|
||||
b.setRecipeType { listOf(RecipeTypes.SMELTING) }
|
||||
}
|
||||
|
||||
MMenus.POWERED_BLAST_FURNACE -> {
|
||||
a.setRecipeType { listOf(RecipeTypes.BLASTING) }
|
||||
b.setRecipeType { listOf(RecipeTypes.BLASTING) }
|
||||
}
|
||||
|
||||
MMenus.POWERED_SMOKER -> {
|
||||
a.setRecipeType { listOf(MicrowaveRecipeCategory.recipeType, RecipeTypes.SMOKING) }
|
||||
b.setRecipeType { listOf(MicrowaveRecipeCategory.recipeType, RecipeTypes.SMOKING) }
|
||||
}
|
||||
}
|
||||
|
||||
return frame
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package ru.dbotthepony.mc.otm.client.screen.tech
|
||||
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.BatterySlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.SlotPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.widget.WideProfiledPowerGaugePanel
|
||||
import ru.dbotthepony.mc.otm.compat.jei.PlatePressRecipeCategory
|
||||
import ru.dbotthepony.mc.otm.menu.tech.TwinPlatePressMenu
|
||||
|
||||
class TwinPlatePressScreen(menu: TwinPlatePressMenu, inventory: Inventory, title: Component) :
|
||||
MatteryScreen<TwinPlatePressMenu>(menu, inventory, title) {
|
||||
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
|
||||
val frame = super.makeMainFrame()!!
|
||||
|
||||
WideProfiledPowerGaugePanel(this, frame, menu.profiledEnergy, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||
BatterySlotPanel(this, frame, menu.batterySlot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||
|
||||
SlotPanel(this, frame, menu.inputSlots[0], 56f, PROGRESS_SLOT_TOP - 10f)
|
||||
ProgressGaugePanel(this, frame, menu.progressGauge0, 78f, PROGRESS_ARROW_TOP - 10f).setRecipeType { listOf(PlatePressRecipeCategory.recipeType) }
|
||||
SlotPanel(this, frame, menu.outputSlots[0], 104f, PROGRESS_SLOT_TOP - 10f)
|
||||
|
||||
SlotPanel(this, frame, menu.inputSlots[1], 56f, PROGRESS_SLOT_TOP + 10f)
|
||||
ProgressGaugePanel(this, frame, menu.progressGauge1, 78f, PROGRESS_ARROW_TOP + 10f).setRecipeType { listOf(PlatePressRecipeCategory.recipeType) }
|
||||
SlotPanel(this, frame, menu.outputSlots[1], 104f, PROGRESS_SLOT_TOP + 10f)
|
||||
|
||||
makeDeviceControls(this, frame, redstoneConfig = menu.redstoneConfig, energyConfig = menu.energyConfig, itemConfig = menu.itemConfig, balanceInputs = menu.balanceInputs, upgrades = menu.upgrades)
|
||||
|
||||
return frame
|
||||
}
|
||||
}
|
@ -7,7 +7,6 @@ import mezz.jei.api.constants.VanillaTypes
|
||||
import mezz.jei.api.forge.ForgeTypes
|
||||
import mezz.jei.api.gui.handlers.IGuiContainerHandler
|
||||
import mezz.jei.api.helpers.IJeiHelpers
|
||||
import mezz.jei.api.ingredients.ITypedIngredient
|
||||
import mezz.jei.api.registration.IGuiHandlerRegistration
|
||||
import mezz.jei.api.registration.IRecipeCatalystRegistration
|
||||
import mezz.jei.api.registration.IRecipeCategoryRegistration
|
||||
@ -18,7 +17,6 @@ import mezz.jei.api.runtime.IJeiRuntime
|
||||
import net.minecraft.client.renderer.Rect2i
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraftforge.fluids.FluidStack
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.client.minecraft
|
||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||
@ -34,7 +32,6 @@ import ru.dbotthepony.mc.otm.menu.decorative.PainterMenu
|
||||
import ru.dbotthepony.mc.otm.menu.matter.MatterEntanglerMenu
|
||||
import ru.dbotthepony.mc.otm.menu.tech.PlatePressMenu
|
||||
import ru.dbotthepony.mc.otm.menu.tech.PoweredFurnaceMenu
|
||||
import ru.dbotthepony.mc.otm.menu.tech.TwinPlatePressMenu
|
||||
import ru.dbotthepony.mc.otm.recipe.PainterRecipe
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
import ru.dbotthepony.mc.otm.registry.MRecipes
|
||||
@ -77,7 +74,6 @@ class JEIPlugin : IModPlugin {
|
||||
MItems.POWERED_SMOKER.values.forEach { registration.addRecipeCatalyst(ItemStack(it), MicrowaveRecipeCategory.recipeType) }
|
||||
registration.addRecipeCatalyst(ItemStack(MItems.ExopackUpgrades.CRAFTING_UPGRADE), RecipeTypes.CRAFTING)
|
||||
registration.addRecipeCatalyst(ItemStack(MItems.ITEM_MONITOR[null]!!), RecipeTypes.CRAFTING)
|
||||
MItems.PLATE_PRESS.values.forEach { registration.addRecipeCatalyst(ItemStack(it), PlatePressRecipeCategory.recipeType) }
|
||||
MItems.TWIN_PLATE_PRESS.values.forEach { registration.addRecipeCatalyst(ItemStack(it), PlatePressRecipeCategory.recipeType) }
|
||||
registration.addRecipeCatalyst(ItemStack(MItems.PAINTER), PainterRecipeCategory.recipeType)
|
||||
registration.addRecipeCatalyst(ItemStack(MItems.MATTER_ENTANGLER), MatterEntanglerRecipeCategory.recipeType)
|
||||
@ -114,8 +110,7 @@ class JEIPlugin : IModPlugin {
|
||||
registration.addRecipeTransferHandler(ExopackInventoryTransferHandler(helper), RecipeTypes.CRAFTING)
|
||||
registration.addRecipeTransferHandler(simpleTransferInfo(MatterEntanglerRecipeCategory.recipeType, MatterEntanglerMenu::inputs))
|
||||
registration.addRecipeTransferHandler(simpleTransferInfo0(PainterRecipeCategory.recipeType, PainterMenu::inputSlot))
|
||||
registration.addRecipeTransferHandler(simpleTransferInfo0(PlatePressRecipeCategory.recipeType, PlatePressMenu::inputSlot))
|
||||
registration.addRecipeTransferHandler(simpleTransferInfo(PlatePressRecipeCategory.recipeType, TwinPlatePressMenu::inputSlots))
|
||||
registration.addRecipeTransferHandler(simpleTransferInfo(PlatePressRecipeCategory.recipeType, PlatePressMenu::inputSlots))
|
||||
registration.addRecipeTransferHandler(simpleTransferInfo(MicrowaveRecipeCategory.recipeType, PoweredFurnaceMenu::inputSlots))
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ object PlatePressRecipeCategory : IRecipeCategory<PlatePressRecipe>, IDrawable {
|
||||
}
|
||||
|
||||
override fun getTitle(): Component {
|
||||
return MItems.PLATE_PRESS[null]!!.description
|
||||
return MItems.TWIN_PLATE_PRESS[null]!!.description
|
||||
}
|
||||
|
||||
override fun draw(stack: PoseStack, xOffset: Int, yOffset: Int) {
|
||||
@ -96,7 +96,7 @@ object PlatePressRecipeCategory : IRecipeCategory<PlatePressRecipe>, IDrawable {
|
||||
}
|
||||
|
||||
private val iconField by lazy {
|
||||
JEIPlugin.helpers.guiHelper.createDrawableItemStack(ItemStack(MItems.PLATE_PRESS[null]!!))
|
||||
JEIPlugin.helpers.guiHelper.createDrawableItemStack(ItemStack(MItems.TWIN_PLATE_PRESS[null]!!))
|
||||
}
|
||||
|
||||
override fun getIcon(): IDrawable {
|
||||
|
@ -4,6 +4,10 @@ import net.minecraftforge.fml.config.ModConfig
|
||||
|
||||
object ClientConfig : AbstractConfig("client", ModConfig.Type.CLIENT) {
|
||||
|
||||
var HIDE_DESCRIPTION: Boolean by builder
|
||||
.comment("Description of items require SHIFT to be pressed.")
|
||||
.define("HIDE_DESCRIPTION", false)
|
||||
|
||||
var JUMP_BOOST_LOOK_ANGLE: Double by builder
|
||||
.comment("If looking below this angle (actually, looking 'above' as you see in game, but not as you expect it, check with debug screen), Crouch + Jump will trigger jump boost android ability")
|
||||
.defineInRange("JUMP_BOOST_LOOK_ANGLE", 30.0, -180.0, 180.0)
|
||||
|
@ -14,7 +14,7 @@ object ItemsConfig : AbstractConfig("items") {
|
||||
val BASIC = batteryValues(MNames.BATTERY_BASIC, Decimal(400_000), Decimal(600))
|
||||
val NORMAL = batteryValues(MNames.BATTERY_NORMAL, Decimal(2_000_000), Decimal(1_000))
|
||||
val DENSE = batteryValues(MNames.BATTERY_DENSE, Decimal(10_000_000), Decimal(2_000))
|
||||
val CAPACITOR = batteryValues(MNames.BATTERY_CAPACITOR, Decimal(500_000), Decimal(50_000))
|
||||
val CAPACITOR = batteryValues(MNames.BATTERY_CAPACITOR, Decimal(2_000_000), Decimal(50_000))
|
||||
|
||||
val QUANTUM_BATTERY = conciseValues(MNames.QUANTUM_BATTERY, Decimal(40_000_000), Decimal(10_000))
|
||||
val QUANTUM_CAPACITOR = conciseValues(MNames.QUANTUM_CAPACITOR, Decimal(1_000_000), Decimal(200_000))
|
||||
@ -36,7 +36,7 @@ object ItemsConfig : AbstractConfig("items") {
|
||||
object Capacitors {
|
||||
val BASIC by builder.defineDecimal(MNames.MATTER_CAPACITOR_BASIC, Decimal(2_500), minimum = Decimal.ONE_TENTH)
|
||||
val NORMAL by builder.defineDecimal(MNames.MATTER_CAPACITOR_NORMAL, Decimal(10_000), minimum = Decimal.ONE_TENTH)
|
||||
val DENSE by builder.defineDecimal(MNames.MATTER_CAPACITOR_DENSE, Decimal(25_000), minimum = Decimal.ONE_TENTH)
|
||||
val DENSE by builder.defineDecimal(MNames.MATTER_CAPACITOR_DENSE, Decimal(40_000), minimum = Decimal.ONE_TENTH)
|
||||
}
|
||||
|
||||
init {
|
||||
|
@ -1,100 +0,0 @@
|
||||
package ru.dbotthepony.mc.otm.core
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectIterators
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import ru.dbotthepony.mc.otm.client.isShiftDown
|
||||
import ru.dbotthepony.mc.otm.client.minecraft
|
||||
import java.util.stream.Stream
|
||||
|
||||
interface ITooltippable {
|
||||
fun addDescriptionLinesInternal(lines: Stream<out Component>) {
|
||||
addDescriptionFunctionsInternal(lines.map { c -> { ObjectIterators.singleton(c.copy()) } })
|
||||
}
|
||||
|
||||
fun addDescriptionLinesInternal(vararg lines: Component) {
|
||||
lines.forEach { c ->
|
||||
addDescriptionFunctionsInternal({ ObjectIterators.singleton(c.copy()) })
|
||||
}
|
||||
}
|
||||
|
||||
fun addDescriptionLinesInternal(lines: Collection<Component>) {
|
||||
lines.forEach { c ->
|
||||
addDescriptionFunctionsInternal({ ObjectIterators.singleton(c.copy()) })
|
||||
}
|
||||
}
|
||||
|
||||
fun addDescriptionFunctionsInternal(lines: Stream<out (ItemStack) -> Iterator<Component>>)
|
||||
fun addDescriptionFunctionsInternal(vararg lines: (ItemStack) -> Iterator<Component>)
|
||||
fun addDescriptionFunctionsInternal(lines: Collection<(ItemStack) -> Iterator<Component>>)
|
||||
|
||||
fun assembleDescription(itemStack: ItemStack, into: MutableCollection<Component>)
|
||||
|
||||
class Impl : ITooltippable {
|
||||
private val descriptionLines = ArrayList<(ItemStack) -> Iterator<Component>>()
|
||||
|
||||
override fun addDescriptionFunctionsInternal(lines: Stream<out (ItemStack) -> Iterator<Component>>) {
|
||||
lines.forEach { descriptionLines.add(it) }
|
||||
}
|
||||
|
||||
override fun addDescriptionFunctionsInternal(vararg lines: (ItemStack) -> Iterator<Component>) {
|
||||
lines.forEach { descriptionLines.add(it) }
|
||||
}
|
||||
|
||||
override fun addDescriptionFunctionsInternal(lines: Collection<(ItemStack) -> Iterator<Component>>) {
|
||||
lines.forEach { descriptionLines.add(it) }
|
||||
}
|
||||
|
||||
override fun assembleDescription(itemStack: ItemStack, into: MutableCollection<Component>) {
|
||||
if (descriptionLines.isNotEmpty()) {
|
||||
if (!minecraft.window.isShiftDown) {
|
||||
into.add(TranslatableComponent("otm.gui.shift_for_more_info").withStyle(ChatFormatting.GRAY).withStyle(ChatFormatting.ITALIC))
|
||||
} else {
|
||||
for (lines in descriptionLines) {
|
||||
into.addAll(lines.invoke(itemStack))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.addDescriptionLines(lines: Stream<out Component>): T {
|
||||
addDescriptionLinesInternal(lines)
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.addDescriptionLines(vararg lines: Component): T {
|
||||
addDescriptionLinesInternal(lines.stream())
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.addDescriptionLines(lines: Collection<Component>): T {
|
||||
addDescriptionLinesInternal(lines)
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.addDescriptionFunctions(lines: Stream<out (ItemStack) -> Iterator<Component>>): T {
|
||||
addDescriptionFunctionsInternal(lines)
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.addDescriptionFunctions(vararg lines: (ItemStack) -> Iterator<Component>): T {
|
||||
addDescriptionFunctionsInternal(lines.stream())
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.addDescriptionFunctions(line: (ItemStack) -> Iterator<Component>): T {
|
||||
addDescriptionFunctionsInternal(line)
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.addDescriptionFunctions(lines: Collection<(ItemStack) -> Iterator<Component>>): T {
|
||||
addDescriptionFunctionsInternal(lines)
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.needsNoPowerDescription(formatting: ChatFormatting = ChatFormatting.GRAY): T {
|
||||
return addDescriptionLines(TranslatableComponent("otm.needs_no_power").withStyle(formatting))
|
||||
}
|
151
src/main/kotlin/ru/dbotthepony/mc/otm/core/TooltipList.kt
Normal file
151
src/main/kotlin/ru/dbotthepony/mc/otm/core/TooltipList.kt
Normal file
@ -0,0 +1,151 @@
|
||||
package ru.dbotthepony.mc.otm.core
|
||||
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.nbt.CompoundTag
|
||||
import net.minecraft.nbt.Tag
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.item.BlockItem
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
||||
import ru.dbotthepony.mc.otm.capability.energy
|
||||
import ru.dbotthepony.mc.otm.capability.energy.BlockEnergyStorageImpl
|
||||
import ru.dbotthepony.mc.otm.capability.energy.CapacitorEnergyStorage
|
||||
import ru.dbotthepony.mc.otm.capability.energy.GeneratorEnergyStorage
|
||||
import ru.dbotthepony.mc.otm.capability.energy.IMatteryEnergyStorage
|
||||
import ru.dbotthepony.mc.otm.capability.energy.ItemEnergyStorageImpl
|
||||
import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage
|
||||
import ru.dbotthepony.mc.otm.capability.energy.batteryLevel
|
||||
import ru.dbotthepony.mc.otm.capability.fluidLevel
|
||||
import ru.dbotthepony.mc.otm.capability.matter.MatterStorageImpl
|
||||
import ru.dbotthepony.mc.otm.client.ShiftPressedCond
|
||||
import ru.dbotthepony.mc.otm.client.isShiftDown
|
||||
import ru.dbotthepony.mc.otm.client.minecraft
|
||||
import ru.dbotthepony.mc.otm.config.ClientConfig
|
||||
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.core.nbt.map
|
||||
import ru.dbotthepony.mc.otm.core.nbt.mapPresent
|
||||
import ru.dbotthepony.mc.otm.core.util.formatMatter
|
||||
import ru.dbotthepony.mc.otm.core.util.formatPower
|
||||
|
||||
class TooltipList {
|
||||
private val descriptionLines = ArrayList<(itemStack: ItemStack, acceptor: (text: Component) -> Unit) -> Unit>()
|
||||
|
||||
fun assemble(itemStack: ItemStack, into: (Component) -> Unit) {
|
||||
if (descriptionLines.isNotEmpty()) {
|
||||
if (ClientConfig.HIDE_DESCRIPTION && !minecraft.window.isShiftDown && descriptionLines.any { var flag = false; it.invoke(itemStack) { flag = true }; flag }) {
|
||||
into.invoke(TranslatableComponent("otm.gui.shift_for_more_info").withStyle(ChatFormatting.GRAY).withStyle(ChatFormatting.ITALIC))
|
||||
} else {
|
||||
for (lines in descriptionLines) {
|
||||
lines.invoke(itemStack, into)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun assemble(itemStack: ItemStack, into: MutableCollection<Component>) {
|
||||
assemble(itemStack, into::add)
|
||||
}
|
||||
|
||||
fun addNormal(function: (itemStack: ItemStack, acceptor: (text: Component) -> Unit) -> Unit) {
|
||||
descriptionLines.add(function)
|
||||
}
|
||||
|
||||
@JvmName("addPlain")
|
||||
fun add(component: Component) {
|
||||
descriptionLines.add { _, result -> result.invoke(component.copy()) }
|
||||
}
|
||||
|
||||
@JvmName("addFunction2Component")
|
||||
fun add(component: () -> Component) {
|
||||
descriptionLines.add { _, result -> result.invoke(component.invoke()) }
|
||||
}
|
||||
|
||||
fun needsNoPower(formatting: ChatFormatting = ChatFormatting.GRAY) {
|
||||
add(TranslatableComponent("otm.needs_no_power").withStyle(formatting))
|
||||
}
|
||||
|
||||
fun painted(color: DyeColor?) {
|
||||
if (color != null) {
|
||||
add(TranslatableComponent("otm.painted.${color.name.lowercase()}").withStyle(ChatFormatting.DARK_GRAY))
|
||||
}
|
||||
}
|
||||
|
||||
fun colored(color: DyeColor?) = painted(color)
|
||||
|
||||
inline fun <reified T : Tag> blockEntityData(key: String, noinline callback: (itemStack: ItemStack, data: T, acceptor: (line: Component) -> Unit) -> Unit) {
|
||||
addNormal { itemStack, acceptor ->
|
||||
val tag = (itemStack.tag?.get(BlockItem.BLOCK_ENTITY_TAG) as? CompoundTag)?.get(key) as? T ?: return@addNormal
|
||||
callback(itemStack, tag, acceptor)
|
||||
}
|
||||
}
|
||||
|
||||
fun blockEntityEnergy(energyKey: String = MatteryBlockEntity.ENERGY_KEY, batteryKey: String = MatteryBlockEntity.BATTERY_KEY) {
|
||||
blockEntityData<CompoundTag>(energyKey) { _, tag, acceptor ->
|
||||
val stored = tag.mapPresent(BlockEnergyStorageImpl.ENERGY_STORED_KEY, Decimal::deserializeNBT)
|
||||
|
||||
if (stored != null) {
|
||||
acceptor(
|
||||
TranslatableComponent(
|
||||
"otm.item.power.storage0",
|
||||
stored.formatPower(formatAsReadable = ShiftPressedCond)
|
||||
).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
val container = MatteryContainer(1)
|
||||
tag.map(batteryKey, container::deserializeNBT)
|
||||
|
||||
if (!container[0].isEmpty) {
|
||||
acceptor(TranslatableComponent("otm.item.block.stored_battery", container[0].displayName).withStyle(ChatFormatting.GRAY))
|
||||
|
||||
val energy = container[0].energy ?: return@blockEntityData
|
||||
|
||||
if (energy is IMatteryEnergyStorage) {
|
||||
batteryLevel(energy, acceptor)
|
||||
} else {
|
||||
batteryLevel(energy, acceptor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun blockEntityMatter(matterKey: String = MatteryBlockEntity.MATTER_STORAGE_KEY) {
|
||||
blockEntityData<CompoundTag>(matterKey) { _, tag, acceptor ->
|
||||
val stored = tag.mapPresent(MatterStorageImpl.MATTER_STORED_KEY, Decimal::deserializeNBT)
|
||||
|
||||
if (stored != null) {
|
||||
acceptor(
|
||||
TranslatableComponent(
|
||||
"otm.item.matter.storage0",
|
||||
stored.formatMatter(formatAsReadable = ShiftPressedCond)
|
||||
).withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun itemEnergy() {
|
||||
addNormal { itemStack, acceptor ->
|
||||
val energy = itemStack.energy ?: return@addNormal
|
||||
|
||||
if (energy is IMatteryEnergyStorage) {
|
||||
batteryLevel(energy, acceptor)
|
||||
} else {
|
||||
batteryLevel(energy, acceptor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun doubleProcessing() {
|
||||
add(TranslatableComponent("otm.gui.double_processing").withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
fun itemFluid() {
|
||||
addNormal { itemStack, acceptor ->
|
||||
itemStack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).ifPresentK {
|
||||
it.fluidLevel(acceptor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -380,6 +380,14 @@ fun <T> emptyIterator(): MutableIterator<T> {
|
||||
return ObjectIterators.emptyIterator()
|
||||
}
|
||||
|
||||
fun <T> iteratorOf(value: T): MutableIterator<T> {
|
||||
return ObjectIterators.singleton(value)
|
||||
}
|
||||
|
||||
fun <T> iteratorOf(vararg value: T): MutableIterator<T> {
|
||||
return ObjectIterators.wrap(value)
|
||||
}
|
||||
|
||||
fun <T> Iterator<T>.toStream(): Stream<T> {
|
||||
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(this, 0), false)
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import ru.dbotthepony.mc.otm.registry.MDamageTypes
|
||||
import ru.dbotthepony.mc.otm.runIfClient
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
open class BatteryItem : Item {
|
||||
open class BatteryItem : MatteryItem {
|
||||
val _capacity: () -> Decimal
|
||||
val _receive: () -> Decimal
|
||||
val _extract: () -> Decimal
|
||||
@ -103,14 +103,8 @@ open class BatteryItem : Item {
|
||||
return p_150901_.matteryEnergy?.getBarColor() ?: super.getBarColor(p_150901_)
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
stack: ItemStack,
|
||||
p_41422_: Level?,
|
||||
p_41423_: MutableList<Component>,
|
||||
p_41424_: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(stack, p_41422_, p_41423_, p_41424_)
|
||||
ItemEnergyStorageImpl.appendHoverText(stack, p_41423_)
|
||||
init {
|
||||
tooltips.itemEnergy()
|
||||
}
|
||||
|
||||
override fun initCapabilities(stack: ItemStack, nbt: CompoundTag?): ICapabilityProvider {
|
||||
@ -119,19 +113,14 @@ open class BatteryItem : Item {
|
||||
}
|
||||
|
||||
class CrudeBatteryItem : BatteryItem(ItemsConfig.Batteries.CRUDE) {
|
||||
override fun appendHoverText(
|
||||
stack: ItemStack,
|
||||
p_41422_: Level?,
|
||||
p_41423_: MutableList<Component>,
|
||||
p_41424_: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(stack, p_41422_, p_41423_, p_41424_)
|
||||
init {
|
||||
tooltips.addNormal { itemStack, acceptor ->
|
||||
val isAndroid = runIfClient(false) { minecraft.player?.matteryPlayer?.isAndroid ?: false }
|
||||
|
||||
val isAndroid = runIfClient(false) { minecraft.player?.matteryPlayer?.isAndroid ?: false }
|
||||
|
||||
if (isAndroid) {
|
||||
p_41423_.add(TranslatableComponent("otm.gui.crude_battery.replace_in_world").withStyle(ChatFormatting.GRAY))
|
||||
p_41423_.add(TranslatableComponent("otm.gui.crude_battery.replace_in_world_warning").withStyle(ChatFormatting.DARK_RED))
|
||||
if (isAndroid) {
|
||||
acceptor(TranslatableComponent("otm.gui.crude_battery.replace_in_world").withStyle(ChatFormatting.GRAY))
|
||||
acceptor(TranslatableComponent("otm.gui.crude_battery.replace_in_world_warning").withStyle(ChatFormatting.DARK_RED))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ import ru.dbotthepony.mc.otm.core.isNotEmpty
|
||||
import ru.dbotthepony.mc.otm.core.orNull
|
||||
import java.util.function.IntSupplier
|
||||
|
||||
class FluidCapsuleItem(val capacity: IntSupplier) : Item(Properties().stacksTo(64)) {
|
||||
class FluidCapsuleItem(val capacity: IntSupplier) : MatteryItem(Properties().stacksTo(64)) {
|
||||
// TODO: Так как использование предмета заблокировано за player.abilities.canBuild
|
||||
// капсулу нельзя использовать в режиме приключения
|
||||
// почему же можно использовать вёдра на котлах?
|
||||
@ -72,12 +72,8 @@ class FluidCapsuleItem(val capacity: IntSupplier) : Item(Properties().stacksTo(6
|
||||
return super.getName(pStack)
|
||||
}
|
||||
|
||||
override fun appendHoverText(pStack: ItemStack, pLevel: Level?, pTooltipComponents: MutableList<Component>, pIsAdvanced: TooltipFlag) {
|
||||
super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced)
|
||||
|
||||
pStack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).ifPresentK {
|
||||
it.fluidLevel(pTooltipComponents)
|
||||
}
|
||||
init {
|
||||
tooltips.itemFluid()
|
||||
}
|
||||
|
||||
override fun initCapabilities(stack: ItemStack, nbt: CompoundTag?): ICapabilityProvider {
|
||||
|
@ -17,12 +17,19 @@ import ru.dbotthepony.mc.otm.block.entity.decorative.FluidTankBlockEntity
|
||||
import ru.dbotthepony.mc.otm.capability.fluid.BlockMatteryFluidHandler
|
||||
import ru.dbotthepony.mc.otm.capability.fluidLevel
|
||||
import ru.dbotthepony.mc.otm.client.render.blockentity.FluidTankRenderer
|
||||
import ru.dbotthepony.mc.otm.core.TooltipList
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.ifPresentK
|
||||
import java.util.function.Consumer
|
||||
import java.util.function.IntSupplier
|
||||
|
||||
class FluidTankItem(block: FluidTankBlock, properties: Properties, val capacity: IntSupplier) : BlockItem(block, properties) {
|
||||
val tooltips = TooltipList()
|
||||
|
||||
init {
|
||||
tooltips.itemFluid()
|
||||
}
|
||||
|
||||
override fun initCapabilities(stack: ItemStack, nbt: CompoundTag?): ICapabilityProvider {
|
||||
return BlockMatteryFluidHandler.Item(stack, capacity, FluidTankBlockEntity.FLUID_KEY)
|
||||
}
|
||||
@ -53,10 +60,7 @@ class FluidTankItem(block: FluidTankBlock, properties: Properties, val capacity:
|
||||
|
||||
override fun appendHoverText(pStack: ItemStack, pLevel: Level?, pTooltip: MutableList<Component>, pFlag: TooltipFlag) {
|
||||
super.appendHoverText(pStack, pLevel, pTooltip, pFlag)
|
||||
|
||||
pStack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).ifPresentK {
|
||||
it.fluidLevel(pTooltip)
|
||||
}
|
||||
tooltips.assemble(pStack, pTooltip::add)
|
||||
}
|
||||
|
||||
override fun initializeClient(consumer: Consumer<IClientItemExtensions>) {
|
||||
|
@ -7,22 +7,19 @@ import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.level.Level
|
||||
import ru.dbotthepony.mc.otm.client.isShiftDown
|
||||
import ru.dbotthepony.mc.otm.client.minecraft
|
||||
import ru.dbotthepony.mc.otm.core.ITooltippable
|
||||
import ru.dbotthepony.mc.otm.core.TooltipList
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.addAll
|
||||
import ru.dbotthepony.mc.otm.core.addDescriptionFunctions
|
||||
import ru.dbotthepony.mc.otm.core.addDescriptionLines
|
||||
import java.util.stream.Stream
|
||||
|
||||
open class MatteryItem(properties: Properties) : Item(properties), ITooltippable by ITooltippable.Impl() {
|
||||
open class MatteryItem(properties: Properties) : Item(properties) {
|
||||
val tooltips = TooltipList()
|
||||
|
||||
override fun appendHoverText(itemStack: ItemStack, level: Level?, components: MutableList<Component>, tooltipType: TooltipFlag) {
|
||||
super.appendHoverText(itemStack, level, components, tooltipType)
|
||||
assembleDescription(itemStack, components)
|
||||
tooltips.assemble(itemStack, components)
|
||||
}
|
||||
}
|
||||
|
||||
fun <T : MatteryItem> T.addSimpleDescription(suffix: String = "", formatting: ChatFormatting = ChatFormatting.GRAY): T {
|
||||
return addDescriptionFunctions { ObjectIterators.singleton(TranslatableComponent("$descriptionId.desc$suffix").withStyle(formatting)) }
|
||||
tooltips.add { TranslatableComponent("$descriptionId.desc$suffix").withStyle(formatting) }
|
||||
return this
|
||||
}
|
||||
|
@ -18,8 +18,9 @@ import net.minecraft.world.level.gameevent.GameEvent
|
||||
import ru.dbotthepony.mc.otm.entity.MinecartCargoCrate
|
||||
import ru.dbotthepony.mc.otm.registry.MEntityTypes
|
||||
|
||||
class MinecartCargoCrateItem(val color: DyeColor?) : Item(Properties().stacksTo(16)) {
|
||||
class MinecartCargoCrateItem(val color: DyeColor?) : MatteryItem(Properties().stacksTo(16)) {
|
||||
init {
|
||||
tooltips.painted(color)
|
||||
DispenserBlock.registerBehavior(this, Companion)
|
||||
}
|
||||
|
||||
|
@ -18,21 +18,14 @@ enum class PillType {
|
||||
BECOME_ANDROID, BECOME_HUMANE, OBLIVION
|
||||
}
|
||||
|
||||
class HealPillItem : Item(Properties().stacksTo(64).rarity(Rarity.UNCOMMON)) {
|
||||
override fun getUseDuration(p_41454_: ItemStack): Int {
|
||||
class HealPillItem : MatteryItem(Properties().stacksTo(64).rarity(Rarity.UNCOMMON)) {
|
||||
override fun getUseDuration(itemStack: ItemStack): Int {
|
||||
return 24
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
p_41421_: ItemStack,
|
||||
p_41422_: Level?,
|
||||
p_41423_: MutableList<Component>,
|
||||
p_41424_: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(p_41421_, p_41422_, p_41423_, p_41424_)
|
||||
|
||||
p_41423_.add(TranslatableComponent("otm.pill.heal").withStyle(ChatFormatting.GRAY))
|
||||
p_41423_.add(TranslatableComponent("otm.pill.heal_android").withStyle(ChatFormatting.GRAY))
|
||||
init {
|
||||
tooltips.add(TranslatableComponent("otm.pill.heal").withStyle(ChatFormatting.GRAY))
|
||||
tooltips.add(TranslatableComponent("otm.pill.heal_android").withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
|
||||
override fun use(level: Level, ply: Player, hand: InteractionHand): InteractionResultHolder<ItemStack> {
|
||||
@ -62,33 +55,24 @@ class HealPillItem : Item(Properties().stacksTo(64).rarity(Rarity.UNCOMMON)) {
|
||||
override fun getUseAnimation(p_41452_: ItemStack): UseAnim = UseAnim.EAT
|
||||
}
|
||||
|
||||
class PillItem(val pillType: PillType) :
|
||||
Item(Properties().stacksTo(64).rarity(Rarity.UNCOMMON)) {
|
||||
class PillItem(val pillType: PillType) : MatteryItem(Properties().stacksTo(64).rarity(Rarity.UNCOMMON)) {
|
||||
init {
|
||||
when (pillType) {
|
||||
PillType.BECOME_ANDROID -> tooltips.add(TranslatableComponent("otm.pill.android").withStyle(ChatFormatting.GRAY))
|
||||
|
||||
PillType.BECOME_HUMANE -> {
|
||||
tooltips.add(TranslatableComponent("otm.pill.humane").withStyle(ChatFormatting.GRAY))
|
||||
tooltips.add(TranslatableComponent("otm.pill.warning").withStyle(ChatFormatting.RED))
|
||||
}
|
||||
|
||||
PillType.OBLIVION -> tooltips.add(TranslatableComponent("otm.pill.oblivion").withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
}
|
||||
|
||||
override fun getUseDuration(p_41454_: ItemStack): Int {
|
||||
return 32
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
p_41421_: ItemStack,
|
||||
p_41422_: Level?,
|
||||
p_41423_: MutableList<Component>,
|
||||
p_41424_: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(p_41421_, p_41422_, p_41423_, p_41424_)
|
||||
|
||||
when (pillType) {
|
||||
PillType.BECOME_ANDROID -> p_41423_.add(TranslatableComponent("otm.pill.android").withStyle(ChatFormatting.GRAY))
|
||||
|
||||
PillType.BECOME_HUMANE -> {
|
||||
p_41423_.add(TranslatableComponent("otm.pill.humane").withStyle(ChatFormatting.GRAY))
|
||||
p_41423_.add(TranslatableComponent("otm.pill.warning").withStyle(ChatFormatting.RED))
|
||||
}
|
||||
|
||||
PillType.OBLIVION -> p_41423_.add(TranslatableComponent("otm.pill.oblivion").withStyle(ChatFormatting.GRAY))
|
||||
}
|
||||
}
|
||||
|
||||
override fun use(level: Level, ply: Player, hand: InteractionHand): InteractionResultHolder<ItemStack> {
|
||||
val resolver = ply.getCapability(MatteryCapability.MATTERY_PLAYER).resolve()
|
||||
|
||||
|
@ -29,7 +29,7 @@ import ru.dbotthepony.mc.otm.data.DecimalProvider
|
||||
import ru.dbotthepony.mc.otm.registry.MItemFunctionTypes
|
||||
import java.util.Optional
|
||||
|
||||
class ProceduralBatteryItem : Item(Properties().stacksTo(1)) {
|
||||
class ProceduralBatteryItem : MatteryItem(Properties().stacksTo(1)) {
|
||||
class Cap(stack: ItemStack) : ItemEnergyStorageImpl(stack) {
|
||||
override var maxInput: Decimal
|
||||
get() = itemStack.tag?.mapPresent("maxInput", Decimal.Companion::deserializeNBT) ?: Decimal.ZERO
|
||||
@ -62,16 +62,16 @@ class ProceduralBatteryItem : Item(Properties().stacksTo(1)) {
|
||||
return p_150901_.matteryEnergy?.getBarColor() ?: super.getBarColor(p_150901_)
|
||||
}
|
||||
|
||||
override fun appendHoverText(p_41421_: ItemStack, p_41422_: Level?, p_41423_: MutableList<Component>, p_41424_: TooltipFlag) {
|
||||
super.appendHoverText(p_41421_, p_41422_, p_41423_, p_41424_)
|
||||
init {
|
||||
tooltips.addNormal { itemStack, acceptor ->
|
||||
val energy = itemStack.matteryEnergy
|
||||
|
||||
val energy = p_41421_.matteryEnergy
|
||||
|
||||
if (energy is Cap) {
|
||||
if (energy.maxInput.isZero && energy.maxOutput.isZero && energy.maxBatteryLevel.isZero) {
|
||||
p_41423_.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.GRAY))
|
||||
} else {
|
||||
batteryLevel(energy, p_41423_)
|
||||
if (energy is Cap) {
|
||||
if (energy.maxInput.isZero && energy.maxOutput.isZero && energy.maxBatteryLevel.isZero) {
|
||||
acceptor(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.GRAY))
|
||||
} else {
|
||||
batteryLevel(energy, acceptor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class SimpleUpgrade(
|
||||
override val matterStorage: Decimal = Decimal.ZERO,
|
||||
override val matterStorageFlat: Decimal = Decimal.ZERO,
|
||||
override val failureMultiplier: Double = 1.0,
|
||||
) : Item(properties), IMatteryUpgrade, ICapabilityProvider {
|
||||
) : MatteryItem(properties), IMatteryUpgrade, ICapabilityProvider {
|
||||
private val resolver = LazyOptional.of { this }
|
||||
|
||||
override fun <T : Any?> getCapability(cap: Capability<T>, side: Direction?): LazyOptional<T> {
|
||||
@ -41,9 +41,10 @@ class SimpleUpgrade(
|
||||
return LazyOptional.empty()
|
||||
}
|
||||
|
||||
override fun appendHoverText(p_41421_: ItemStack, p_41422_: Level?, p_41423_: MutableList<Component>, p_41424_: TooltipFlag) {
|
||||
super.appendHoverText(p_41421_, p_41422_, p_41423_, p_41424_)
|
||||
addUpgradeTooltipLines(p_41423_)
|
||||
init {
|
||||
tooltips.addNormal { _, acceptor ->
|
||||
addUpgradeTooltipLines(acceptor)
|
||||
}
|
||||
}
|
||||
|
||||
override fun initCapabilities(stack: ItemStack, nbt: CompoundTag?): ICapabilityProvider {
|
||||
|
@ -23,22 +23,16 @@ open class SingleUseBatteryItem(
|
||||
private val _capacity: () -> Decimal,
|
||||
private val _throughput: () -> Decimal? = { null },
|
||||
properties: Properties = Properties().stacksTo(1)
|
||||
) : Item(properties) {
|
||||
) : MatteryItem(properties) {
|
||||
constructor(values: EnergyBalanceValues, properties: Properties = Properties().stacksTo(1)) : this(values::energyCapacity, values::energyThroughput, properties)
|
||||
constructor(storage: Decimal, throughput: Decimal? = null, properties: Properties = Properties().stacksTo(1)) : this({ storage }, { throughput }, properties)
|
||||
|
||||
val capacity get() = _capacity.invoke()
|
||||
val throughput get() = _throughput.invoke()
|
||||
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
p_41422_: Level?,
|
||||
list: MutableList<Component>,
|
||||
p_41424_: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(itemStack, p_41422_, list, p_41424_)
|
||||
list.add(TranslatableComponent("otm.battery.single_use").withStyle(ChatFormatting.GRAY))
|
||||
ItemEnergyStorageImpl.appendHoverText(itemStack, list)
|
||||
init {
|
||||
tooltips.add(TranslatableComponent("otm.battery.single_use").withStyle(ChatFormatting.GRAY))
|
||||
tooltips.itemEnergy()
|
||||
}
|
||||
|
||||
override fun initCapabilities(stack: ItemStack, nbt: CompoundTag?): ICapabilityProvider {
|
||||
@ -59,13 +53,7 @@ open class SingleUseBatteryItem(
|
||||
}
|
||||
|
||||
class ZPMItem : SingleUseBatteryItem(ItemsConfig.Batteries.ZPM, Properties().stacksTo(1).rarity(Rarity.EPIC)) {
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
p_41422_: Level?,
|
||||
list: MutableList<Component>,
|
||||
p_41424_: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(itemStack, p_41422_, list, p_41424_)
|
||||
list.add(TranslatableComponent("$descriptionId.description").withStyle(ChatFormatting.DARK_GRAY))
|
||||
init {
|
||||
tooltips.add(TranslatableComponent("$descriptionId.description").withStyle(ChatFormatting.DARK_GRAY))
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,10 @@
|
||||
package ru.dbotthepony.mc.otm.item.matter
|
||||
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.MethodsReturnNonnullByDefault
|
||||
import net.minecraft.core.Direction
|
||||
import net.minecraft.nbt.CompoundTag
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.Rarity
|
||||
import net.minecraft.world.item.TooltipFlag
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraftforge.common.capabilities.Capability
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider
|
||||
import net.minecraftforge.common.util.LazyOptional
|
||||
@ -23,11 +18,9 @@ import ru.dbotthepony.mc.otm.core.util.formatMatter
|
||||
import ru.dbotthepony.mc.otm.core.ifPresentK
|
||||
import ru.dbotthepony.mc.otm.core.nbt.map
|
||||
import ru.dbotthepony.mc.otm.core.tagNotNull
|
||||
import javax.annotation.ParametersAreNonnullByDefault
|
||||
import ru.dbotthepony.mc.otm.item.MatteryItem
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
class MatterCapacitorItem : Item {
|
||||
class MatterCapacitorItem : MatteryItem {
|
||||
private inner class Matter(private val stack: ItemStack) : ICapabilityProvider, IMatterStorage {
|
||||
private val resolver = LazyOptional.of<IMatterStorage> { this }
|
||||
|
||||
@ -37,7 +30,7 @@ class MatterCapacitorItem : Item {
|
||||
|
||||
override var storedMatter: Decimal
|
||||
get() {
|
||||
if (isCreative) return Decimal.LONG_MAX_VALUE
|
||||
if (isCreative) return Decimal.POSITIVE_INFINITY
|
||||
return stack.tag?.map("matter", Decimal.Companion::deserializeNBT) ?: Decimal.ZERO
|
||||
}
|
||||
set(value) {
|
||||
@ -49,7 +42,7 @@ class MatterCapacitorItem : Item {
|
||||
}
|
||||
|
||||
override val missingMatter: Decimal get() {
|
||||
return if (isCreative) Decimal.LONG_MAX_VALUE else super.missingMatter
|
||||
return if (isCreative) Decimal.POSITIVE_INFINITY else super.missingMatter
|
||||
}
|
||||
|
||||
override fun receiveMatter(howMuch: Decimal, simulate: Boolean): Decimal {
|
||||
@ -96,7 +89,7 @@ class MatterCapacitorItem : Item {
|
||||
|
||||
constructor() : super(Properties().stacksTo(1).rarity(Rarity.EPIC)) {
|
||||
isCreative = true
|
||||
_capacity = { Decimal.LONG_MAX_VALUE }
|
||||
_capacity = { Decimal.POSITIVE_INFINITY }
|
||||
}
|
||||
|
||||
override fun isBarVisible(p_150899_: ItemStack): Boolean {
|
||||
@ -120,20 +113,12 @@ class MatterCapacitorItem : Item {
|
||||
return p_150901_.matter?.getBarColor() ?: super.getBarColor(p_150901_)
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
stack: ItemStack,
|
||||
p_41422_: Level?,
|
||||
p_41423_: MutableList<Component>,
|
||||
p_41424_: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(stack, p_41422_, p_41423_, p_41424_)
|
||||
if (isCreative) {
|
||||
p_41423_.add(INFINITE_STORAGE)
|
||||
} else {
|
||||
stack.getCapability(MatteryCapability.MATTER).ifPresentK {
|
||||
p_41423_.add(
|
||||
init {
|
||||
tooltips.addNormal { itemStack, acceptor ->
|
||||
itemStack.getCapability(MatteryCapability.MATTER).ifPresentK {
|
||||
acceptor(
|
||||
TranslatableComponent(
|
||||
"otm.item.matter.normal",
|
||||
"otm.item.matter.storage",
|
||||
it.storedMatter.formatMatter(formatAsReadable = ShiftPressedCond),
|
||||
capacity.formatMatter(formatAsReadable = ShiftPressedCond)
|
||||
).withStyle(ChatFormatting.GRAY)
|
||||
@ -147,10 +132,7 @@ class MatterCapacitorItem : Item {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val maxInput = Decimal.LONG_MAX_VALUE
|
||||
private val maxOutput = Decimal.LONG_MAX_VALUE
|
||||
|
||||
private val INFINITE_STORAGE: Component =
|
||||
TranslatableComponent("otm.item.matter.infinite").withStyle(ChatFormatting.GRAY)
|
||||
private val maxInput = Decimal.POSITIVE_INFINITY
|
||||
private val maxOutput = Decimal.POSITIVE_INFINITY
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import ru.dbotthepony.mc.otm.core.nbt.ints
|
||||
import ru.dbotthepony.mc.otm.core.nbt.uuids
|
||||
import ru.dbotthepony.mc.otm.core.tagNotNull
|
||||
import ru.dbotthepony.mc.otm.core.util.formatPower
|
||||
import ru.dbotthepony.mc.otm.item.MatteryItem
|
||||
import ru.dbotthepony.mc.otm.network.MNetworkContext
|
||||
import ru.dbotthepony.mc.otm.network.MatteryPacket
|
||||
import ru.dbotthepony.mc.otm.network.WeaponNetworkChannel
|
||||
@ -136,7 +137,7 @@ open class WeaponDataTable(val tag: CompoundTag) {
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AbstractWeaponItem<D : WeaponDataTable>(val tables: KClass<D>, properties: Properties = Properties().stacksTo(1).rarity(Rarity.RARE)) : Item(properties) {
|
||||
abstract class AbstractWeaponItem<D : WeaponDataTable>(val tables: KClass<D>, properties: Properties = Properties().stacksTo(1).rarity(Rarity.RARE)) : MatteryItem(properties) {
|
||||
fun makeDataTable(tag: CompoundTag) = tables.primaryConstructor!!.call(tag)
|
||||
|
||||
/**
|
||||
|
@ -45,10 +45,12 @@ import ru.dbotthepony.mc.otm.core.math.nextVariance
|
||||
import ru.dbotthepony.mc.otm.core.orNull
|
||||
import ru.dbotthepony.mc.otm.core.util.WriteOnce
|
||||
import ru.dbotthepony.mc.otm.registry.EMPDamageSource
|
||||
import ru.dbotthepony.mc.otm.item.MatteryItem
|
||||
import ru.dbotthepony.mc.otm.item.addSimpleDescription
|
||||
import ru.dbotthepony.mc.otm.registry.MDamageTypes
|
||||
import ru.dbotthepony.mc.otm.registry.MatteryDamageSource
|
||||
|
||||
class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE)), Vanishable {
|
||||
class EnergySwordItem : MatteryItem(Properties().stacksTo(1).rarity(Rarity.RARE)), Vanishable {
|
||||
val chargedAttributes: Multimap<Attribute, AttributeModifier>
|
||||
val dischargedAttributes: Multimap<Attribute, AttributeModifier>
|
||||
|
||||
@ -141,20 +143,13 @@ class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE)), Vani
|
||||
return p_150901_.matteryEnergy?.getBarColor() ?: super.getBarColor(p_150901_)
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
p_41422_: Level?,
|
||||
p_41423_: MutableList<Component>,
|
||||
p_41424_: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(itemStack, p_41422_, p_41423_, p_41424_)
|
||||
init {
|
||||
tooltips.itemEnergy()
|
||||
|
||||
ItemEnergyStorageImpl.appendHoverText(itemStack, p_41423_)
|
||||
|
||||
p_41423_.add(DESCRIPTION)
|
||||
p_41423_.add(DESCRIPTION2)
|
||||
p_41423_.add(DESCRIPTION3)
|
||||
p_41423_.add(DESCRIPTION4)
|
||||
addSimpleDescription()
|
||||
addSimpleDescription("2")
|
||||
addSimpleDescription("3")
|
||||
addSimpleDescription("4")
|
||||
}
|
||||
|
||||
override fun mineBlock(
|
||||
@ -256,10 +251,5 @@ class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE)), Vani
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
private val DESCRIPTION = TranslatableComponent("item.overdrive_that_matters.energy_sword.desc").withStyle(ChatFormatting.DARK_GRAY)
|
||||
private val DESCRIPTION2 = TranslatableComponent("item.overdrive_that_matters.energy_sword.desc2").withStyle(ChatFormatting.DARK_GRAY)
|
||||
private val DESCRIPTION3 = TranslatableComponent("item.overdrive_that_matters.energy_sword.desc3").withStyle(ChatFormatting.DARK_GRAY)
|
||||
private val DESCRIPTION4 = TranslatableComponent("item.overdrive_that_matters.energy_sword.desc4").withStyle(ChatFormatting.DARK_GRAY)
|
||||
}
|
||||
}
|
||||
|
@ -174,15 +174,8 @@ open class PlasmaWeaponDataTable(tag: CompoundTag) : WeaponDataTable(tag) {
|
||||
}
|
||||
|
||||
abstract class PlasmaWeaponItem<D : PlasmaWeaponDataTable>(tables: KClass<D>, private val energyCapacity: Decimal) : AbstractWeaponItem<D>(tables) {
|
||||
override fun appendHoverText(
|
||||
itemStack: ItemStack,
|
||||
p_41422_: Level?,
|
||||
p_41423_: MutableList<Component>,
|
||||
p_41424_: TooltipFlag
|
||||
) {
|
||||
super.appendHoverText(itemStack, p_41422_, p_41423_, p_41424_)
|
||||
|
||||
ItemEnergyStorageImpl.appendHoverText(itemStack, p_41423_)
|
||||
init {
|
||||
tooltips.itemEnergy()
|
||||
}
|
||||
|
||||
fun energyData(itemStack: ItemStack) = itemStack.matteryEnergy as PlasmaWeaponEnergy
|
||||
|
@ -0,0 +1,43 @@
|
||||
package ru.dbotthepony.mc.otm.menu.tech
|
||||
|
||||
import mezz.jei.api.recipe.RecipeType
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import net.minecraft.world.inventory.MenuType
|
||||
import net.minecraft.world.inventory.Slot
|
||||
import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity
|
||||
import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu
|
||||
import ru.dbotthepony.mc.otm.menu.UpgradeSlots
|
||||
import ru.dbotthepony.mc.otm.menu.input.BooleanInputWithFeedback
|
||||
import ru.dbotthepony.mc.otm.menu.input.EnergyConfigPlayerInput
|
||||
import ru.dbotthepony.mc.otm.menu.input.ItemConfigPlayerInput
|
||||
import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget
|
||||
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
|
||||
import java.util.function.Supplier
|
||||
|
||||
abstract class AbstractProcessingMachineMenu(
|
||||
type: MenuType<*>,
|
||||
containerID: Int,
|
||||
inventory: Inventory,
|
||||
tile: MatteryPoweredBlockEntity? = null
|
||||
) : MatteryPoweredMenu(type, containerID, inventory, tile) {
|
||||
data class ProcessingTuple(
|
||||
val input: Slot,
|
||||
val output: Slot,
|
||||
val progress: ProgressGaugeWidget
|
||||
)
|
||||
|
||||
abstract val processingTuples: List<ProcessingTuple>
|
||||
|
||||
abstract val itemConfig: ItemConfigPlayerInput?
|
||||
abstract val energyConfig: EnergyConfigPlayerInput?
|
||||
abstract val profiledEnergy: ProfiledLevelGaugeWidget<*>
|
||||
abstract val balanceInputs: BooleanInputWithFeedback?
|
||||
abstract val upgrades: UpgradeSlots?
|
||||
|
||||
open val recipeTypes: Supplier<List<RecipeType<*>>>?
|
||||
get() = null
|
||||
|
||||
init {
|
||||
addInventorySlots()
|
||||
}
|
||||
}
|
@ -7,7 +7,6 @@ import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.enchantment.Enchantments
|
||||
import ru.dbotthepony.mc.otm.block.entity.RedstoneSetting
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.EssenceStorageBlockEntity
|
||||
import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
||||
import ru.dbotthepony.mc.otm.core.util.getTotalXpRequiredForLevel
|
||||
import ru.dbotthepony.mc.otm.item.EssenceCapsuleItem
|
||||
import ru.dbotthepony.mc.otm.item.EssenceServoItem
|
||||
@ -19,7 +18,7 @@ import ru.dbotthepony.mc.otm.menu.input.ItemConfigPlayerInput
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
import ru.dbotthepony.mc.otm.registry.MMenus
|
||||
|
||||
class EssenceStorageMenu @JvmOverloads constructor(
|
||||
class EssenceStorageMenu(
|
||||
containerID: Int,
|
||||
inventory: Inventory,
|
||||
tile: EssenceStorageBlockEntity? = null
|
||||
@ -88,18 +87,10 @@ class EssenceStorageMenu @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
init {
|
||||
storeLevels.filter {
|
||||
it.isCreative || it.matteryPlayer?.isAndroid == true || servoSlot.item.item == MItems.ESSENCE_SERVO //|| it.itemsStream(true).anyMatch { it.item == MItems.ESSENCE_SERVO }
|
||||
}
|
||||
|
||||
storeLevels.filter {
|
||||
it.experienceProgress > 0f || it.experienceLevel > 0
|
||||
}
|
||||
|
||||
dispenseLevels.filter {
|
||||
it.isCreative || it.matteryPlayer?.isAndroid == true || servoSlot.item.item == MItems.ESSENCE_SERVO //|| it.itemsStream(true).anyMatch { it.item == MItems.ESSENCE_SERVO }
|
||||
}
|
||||
|
||||
dispenseLevels.filter { (tile?.experienceStored ?: experienceStored) > 0L }
|
||||
|
||||
if (tile != null) {
|
||||
|
@ -1,36 +1,64 @@
|
||||
package ru.dbotthepony.mc.otm.menu.tech
|
||||
|
||||
import mezz.jei.api.recipe.RecipeType
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.world.SimpleContainer
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import net.minecraft.world.inventory.MenuType
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.PlatePressBlockEntity
|
||||
import ru.dbotthepony.mc.otm.compat.jei.PlatePressRecipeCategory
|
||||
import ru.dbotthepony.mc.otm.compat.jei.isJeiLoaded
|
||||
import ru.dbotthepony.mc.otm.core.immutableList
|
||||
import ru.dbotthepony.mc.otm.menu.OutputSlot
|
||||
import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu
|
||||
import ru.dbotthepony.mc.otm.menu.MatterySlot
|
||||
import ru.dbotthepony.mc.otm.menu.input.BooleanInputWithFeedback
|
||||
import ru.dbotthepony.mc.otm.menu.input.EnergyConfigPlayerInput
|
||||
import ru.dbotthepony.mc.otm.menu.input.ItemConfigPlayerInput
|
||||
import ru.dbotthepony.mc.otm.menu.makeSlots
|
||||
import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget
|
||||
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
|
||||
import ru.dbotthepony.mc.otm.registry.MMenus
|
||||
import java.util.function.Supplier
|
||||
|
||||
class PlatePressMenu(
|
||||
type: MenuType<*>,
|
||||
containerID: Int,
|
||||
inventory: Inventory,
|
||||
tile: PlatePressBlockEntity? = null
|
||||
) : MatteryPoweredMenu(MMenus.PLATE_PRESS, containerID, inventory, tile) {
|
||||
val inputSlot = MatterySlot(tile?.inputContainer ?: SimpleContainer(1), 0)
|
||||
val outputSlot = OutputSlot(tile?.outputContainer ?: SimpleContainer(1), 0) { tile?.experience?.popExperience(player as ServerPlayer) }
|
||||
tile: PlatePressBlockEntity? = null,
|
||||
isTwin: Boolean
|
||||
) : AbstractProcessingMachineMenu(type, containerID, inventory, tile) {
|
||||
val inputSlots = makeSlots(tile?.inputContainer ?: SimpleContainer(if (isTwin) 2 else 1), ::MatterySlot)
|
||||
val outputSlots = makeSlots(tile?.outputContainer ?: SimpleContainer(if (isTwin) 2 else 1)) { a, b -> OutputSlot(a, b) { tile?.experience?.popExperience(player as ServerPlayer) } }
|
||||
val gauges = immutableList(if (isTwin) 2 else 1) { ProgressGaugeWidget(this, tile?.jobEventLoops?.get(it)) }
|
||||
|
||||
val progressGauge = ProgressGaugeWidget(this, tile)
|
||||
val itemConfig = ItemConfigPlayerInput(this, tile?.itemConfig, allowPush = true)
|
||||
val energyConfig = EnergyConfigPlayerInput(this, tile?.energyConfig, allowPull = true)
|
||||
val profiledEnergy = ProfiledLevelGaugeWidget(this, tile?.energy, energyWidget)
|
||||
override val itemConfig = ItemConfigPlayerInput(this, tile?.itemConfig, allowPush = true)
|
||||
override val energyConfig = EnergyConfigPlayerInput(this, tile?.energyConfig, allowPull = true)
|
||||
override val profiledEnergy = ProfiledLevelGaugeWidget(this, tile?.energy, energyWidget)
|
||||
|
||||
val upgrades = makeUpgradeSlots(3, tile?.upgrades)
|
||||
override val balanceInputs = if (isTwin) BooleanInputWithFeedback(this) else null
|
||||
override val upgrades = makeUpgradeSlots(if (isTwin) 4 else 3, tile?.upgrades)
|
||||
|
||||
override val processingTuples: List<ProcessingTuple> = immutableList(if (isTwin) 2 else 1) {
|
||||
ProcessingTuple(inputSlots[it], outputSlots[it], gauges[it])
|
||||
}
|
||||
|
||||
override val recipeTypes: Supplier<List<RecipeType<*>>>
|
||||
get() = Supplier { listOf(PlatePressRecipeCategory.recipeType) }
|
||||
|
||||
init {
|
||||
addStorageSlot(inputSlot)
|
||||
addStorageSlot(outputSlot)
|
||||
addInventorySlots()
|
||||
if (tile != null) balanceInputs?.with(tile::balanceInputs)
|
||||
addStorageSlot(inputSlots)
|
||||
addStorageSlot(outputSlots)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun single(containerID: Int, inventory: Inventory, tile: PlatePressBlockEntity? = null): PlatePressMenu {
|
||||
return PlatePressMenu(MMenus.PLATE_PRESS, containerID, inventory, tile, false)
|
||||
}
|
||||
|
||||
fun twin(containerID: Int, inventory: Inventory, tile: PlatePressBlockEntity? = null): PlatePressMenu {
|
||||
return PlatePressMenu(MMenus.TWIN_PLATE_PRESS, containerID, inventory, tile, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package ru.dbotthepony.mc.otm.menu.tech
|
||||
|
||||
import mezz.jei.api.constants.RecipeTypes
|
||||
import mezz.jei.api.recipe.RecipeType
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import net.minecraft.world.inventory.MenuType
|
||||
@ -7,6 +9,8 @@ import ru.dbotthepony.mc.otm.block.entity.tech.AbstractPoweredFurnaceBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.PoweredBlastFurnaceBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.PoweredFurnaceBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.PoweredSmokerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.compat.jei.MicrowaveRecipeCategory
|
||||
import ru.dbotthepony.mc.otm.compat.jei.isJeiLoaded
|
||||
import ru.dbotthepony.mc.otm.core.immutableList
|
||||
import ru.dbotthepony.mc.otm.menu.OutputSlot
|
||||
import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu
|
||||
@ -18,30 +22,42 @@ import ru.dbotthepony.mc.otm.menu.makeSlots
|
||||
import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget
|
||||
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
|
||||
import ru.dbotthepony.mc.otm.registry.MMenus
|
||||
import java.util.function.Supplier
|
||||
|
||||
class PoweredFurnaceMenu(
|
||||
type: MenuType<PoweredFurnaceMenu>,
|
||||
containerID: Int,
|
||||
inventory: Inventory,
|
||||
tile: AbstractPoweredFurnaceBlockEntity<*, *>? = null
|
||||
) : MatteryPoweredMenu(type, containerID, inventory, tile) {
|
||||
) : AbstractProcessingMachineMenu(type, containerID, inventory, tile) {
|
||||
val inputSlots = makeSlots(tile?.inputs, 2, ::MatterySlot)
|
||||
val outputSlots = makeSlots(tile?.outputs, 2) { c, s -> OutputSlot(c, s) { tile?.experience?.popExperience(player as ServerPlayer) } }
|
||||
|
||||
val progressGauge = immutableList(2) { ProgressGaugeWidget(this, tile?.jobEventLoops?.get(it)) }
|
||||
val itemConfig = ItemConfigPlayerInput(this, tile?.itemConfig, allowPush = true)
|
||||
val energyConfig = EnergyConfigPlayerInput(this, tile?.energyConfig, allowPull = true)
|
||||
val profiledEnergy = ProfiledLevelGaugeWidget(this, tile?.energy, energyWidget)
|
||||
|
||||
val balanceInputs = BooleanInputWithFeedback(this)
|
||||
override val itemConfig = ItemConfigPlayerInput(this, tile?.itemConfig, allowPush = true)
|
||||
override val energyConfig = EnergyConfigPlayerInput(this, tile?.energyConfig, allowPull = true)
|
||||
override val profiledEnergy = ProfiledLevelGaugeWidget(this, tile?.energy, energyWidget)
|
||||
override val balanceInputs = BooleanInputWithFeedback(this)
|
||||
override val upgrades = makeUpgradeSlots(2, tile?.upgrades)
|
||||
|
||||
val upgrades = makeUpgradeSlots(2, tile?.upgrades)
|
||||
override val processingTuples: List<ProcessingTuple> = immutableList(2) {
|
||||
ProcessingTuple(inputSlots[it], outputSlots[it], progressGauge[it])
|
||||
}
|
||||
|
||||
override val recipeTypes: Supplier<List<RecipeType<*>>>?
|
||||
get() {
|
||||
return when (type) {
|
||||
MMenus.POWERED_FURNACE -> Supplier { listOf(RecipeTypes.SMELTING) }
|
||||
MMenus.POWERED_BLAST_FURNACE -> Supplier { listOf(RecipeTypes.BLASTING) }
|
||||
MMenus.POWERED_SMOKER -> Supplier { listOf(MicrowaveRecipeCategory.recipeType, RecipeTypes.SMOKING) }
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
if (tile != null) balanceInputs.with(tile::balanceInputs)
|
||||
addStorageSlot(inputSlots)
|
||||
addStorageSlot(outputSlots)
|
||||
addInventorySlots()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -1,47 +0,0 @@
|
||||
package ru.dbotthepony.mc.otm.menu.tech
|
||||
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.world.SimpleContainer
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.PlatePressBlockEntity
|
||||
import ru.dbotthepony.mc.otm.menu.OutputSlot
|
||||
import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu
|
||||
import ru.dbotthepony.mc.otm.menu.MatterySlot
|
||||
import ru.dbotthepony.mc.otm.menu.input.BooleanInputWithFeedback
|
||||
import ru.dbotthepony.mc.otm.menu.input.EnergyConfigPlayerInput
|
||||
import ru.dbotthepony.mc.otm.menu.input.ItemConfigPlayerInput
|
||||
import ru.dbotthepony.mc.otm.menu.makeSlots
|
||||
import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget
|
||||
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
|
||||
import ru.dbotthepony.mc.otm.registry.MMenus
|
||||
|
||||
class TwinPlatePressMenu(
|
||||
containerID: Int,
|
||||
inventory: Inventory,
|
||||
tile: PlatePressBlockEntity? = null
|
||||
) : MatteryPoweredMenu(MMenus.TWIN_PLATE_PRESS, containerID, inventory, tile) {
|
||||
val inputSlots = makeSlots(tile?.inputContainer ?: SimpleContainer(2), ::MatterySlot)
|
||||
val outputSlots = makeSlots(tile?.outputContainer ?: SimpleContainer(2)) { a, b -> OutputSlot(a, b) { tile?.experience?.popExperience(player as ServerPlayer) } }
|
||||
|
||||
val progressGauge0 = ProgressGaugeWidget(this, tile?.jobEventLoops?.get(0))
|
||||
val progressGauge1 = ProgressGaugeWidget(this, tile?.jobEventLoops?.get(1))
|
||||
val itemConfig = ItemConfigPlayerInput(this, tile?.itemConfig, allowPush = true)
|
||||
val energyConfig = EnergyConfigPlayerInput(this, tile?.energyConfig, allowPull = true)
|
||||
val profiledEnergy = ProfiledLevelGaugeWidget(this, tile?.energy, energyWidget)
|
||||
|
||||
val balanceInputs = BooleanInputWithFeedback(this)
|
||||
|
||||
val upgrades = makeUpgradeSlots(4, tile?.upgrades)
|
||||
|
||||
init {
|
||||
if (tile != null) {
|
||||
balanceInputs.with(tile::balanceInputs)
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
addStorageSlot(inputSlots)
|
||||
addStorageSlot(outputSlots)
|
||||
addInventorySlots()
|
||||
}
|
||||
}
|
@ -81,7 +81,7 @@ class PlatePressRecipe(
|
||||
override fun getType(): RecipeType<PlatePressRecipe> = MRecipes.PLATE_PRESS
|
||||
|
||||
override fun getToastSymbol(): ItemStack {
|
||||
return ItemStack(MItems.PLATE_PRESS[null]!!)
|
||||
return ItemStack(MItems.TWIN_PLATE_PRESS[null]!!)
|
||||
}
|
||||
|
||||
fun toFinished() = SERIALIZER.toFinished(this)
|
||||
|
@ -25,6 +25,7 @@ import ru.dbotthepony.mc.otm.core.tagNotNull
|
||||
import ru.dbotthepony.mc.otm.data.Codec2RecipeSerializer
|
||||
import ru.dbotthepony.mc.otm.data.RecipePair
|
||||
import ru.dbotthepony.mc.otm.data.codec
|
||||
import ru.dbotthepony.mc.otm.data.SingletonCodec
|
||||
import java.util.stream.Stream
|
||||
|
||||
class UpgradeRecipe(
|
||||
@ -85,14 +86,19 @@ class UpgradeRecipe(
|
||||
Codec.STRING.fieldOf("path").forGetter(Direct::path)
|
||||
).apply(it, ::Direct)
|
||||
}
|
||||
}, INDIRECT {
|
||||
},
|
||||
INDIRECT {
|
||||
override val codec: Codec<Indirect> = RecordCodecBuilder.create {
|
||||
it.group(
|
||||
Codec.STRING.fieldOf("source").forGetter(Indirect::pathSource),
|
||||
Codec.STRING.fieldOf("destination").forGetter(Indirect::pathDestination),
|
||||
).apply(it, ::Indirect)
|
||||
}
|
||||
};
|
||||
},
|
||||
ALL {
|
||||
override val codec: Codec<All> by lazy { SingletonCodec(All) }
|
||||
},
|
||||
;
|
||||
|
||||
override fun getSerializedName(): String {
|
||||
return name.lowercase()
|
||||
@ -178,6 +184,17 @@ class UpgradeRecipe(
|
||||
}
|
||||
}
|
||||
|
||||
object All : Op() {
|
||||
override val type: OpType
|
||||
get() = OpType.ALL
|
||||
|
||||
override fun apply(source: CompoundTag, destination: CompoundTag) {
|
||||
source.allKeys.forEach {
|
||||
destination[it] = source[it]!!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val copyPaths: ImmutableList<Op> = copyPaths.collect(ImmutableList.toImmutableList())
|
||||
|
||||
override fun assemble(pInv: CraftingContainer): ItemStack {
|
||||
|
59
src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlockTags.kt
Normal file
59
src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlockTags.kt
Normal file
@ -0,0 +1,59 @@
|
||||
package ru.dbotthepony.mc.otm.registry
|
||||
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.tags.BlockTags
|
||||
import net.minecraft.tags.TagKey
|
||||
import net.minecraft.world.level.block.Block
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
|
||||
@Suppress("unused")
|
||||
object MBlockTags {
|
||||
val CARGO_CRATES: TagKey<Block> = BlockTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "cargo_crates"))
|
||||
val INDUSTRIAL_GLASS: TagKey<Block> = BlockTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "industrial_glass"))
|
||||
|
||||
val CRAFTING_TABLES: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "crafting_tables"))
|
||||
val WORKBENCHES: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "workbenches"))
|
||||
val WORKBENCH: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "workbench"))
|
||||
|
||||
val REQUIRES_TRITANIUM_TOOL: TagKey<Block> = BlockTags.create(ResourceLocation("minecraft", "requires_tritanium_tool"))
|
||||
|
||||
val HARDENED_GLASS_PANES: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes"))
|
||||
val HARDENED_GLASS_PANES_BLACK: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/black"))
|
||||
val HARDENED_GLASS_PANES_BLUE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/blue"))
|
||||
val HARDENED_GLASS_PANES_BROWN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/brown"))
|
||||
val HARDENED_GLASS_PANES_COLORLESS: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/colorless"))
|
||||
val HARDENED_GLASS_PANES_CYAN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/cyan"))
|
||||
val HARDENED_GLASS_PANES_GRAY: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/gray"))
|
||||
val HARDENED_GLASS_PANES_GREEN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/green"))
|
||||
val HARDENED_GLASS_PANES_LIGHT_BLUE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/light_blue"))
|
||||
val HARDENED_GLASS_PANES_LIGHT_GRAY: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/light_gray"))
|
||||
val HARDENED_GLASS_PANES_LIME: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/lime"))
|
||||
val HARDENED_GLASS_PANES_MAGENTA: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/magenta"))
|
||||
val HARDENED_GLASS_PANES_ORANGE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/orange"))
|
||||
val HARDENED_GLASS_PANES_PINK: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/pink"))
|
||||
val HARDENED_GLASS_PANES_PURPLE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/purple"))
|
||||
val HARDENED_GLASS_PANES_RED: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/red"))
|
||||
val HARDENED_GLASS_PANES_WHITE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/white"))
|
||||
val HARDENED_GLASS_PANES_YELLOW: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/yellow"))
|
||||
|
||||
val HARDENED_GLASS: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass"))
|
||||
val HARDENED_GLASS_BLACK: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/black"))
|
||||
val HARDENED_GLASS_BLUE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/blue"))
|
||||
val HARDENED_GLASS_BROWN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/brown"))
|
||||
val HARDENED_GLASS_COLORLESS: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/colorless"))
|
||||
val HARDENED_GLASS_CYAN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/cyan"))
|
||||
val HARDENED_GLASS_GRAY: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/gray"))
|
||||
val HARDENED_GLASS_GREEN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/green"))
|
||||
val HARDENED_GLASS_LIGHT_BLUE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/light_blue"))
|
||||
val HARDENED_GLASS_LIGHT_GRAY: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/light_gray"))
|
||||
val HARDENED_GLASS_LIME: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/lime"))
|
||||
val HARDENED_GLASS_MAGENTA: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/magenta"))
|
||||
val HARDENED_GLASS_ORANGE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/orange"))
|
||||
val HARDENED_GLASS_PINK: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/pink"))
|
||||
val HARDENED_GLASS_PURPLE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/purple"))
|
||||
val HARDENED_GLASS_RED: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/red"))
|
||||
val HARDENED_GLASS_WHITE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/white"))
|
||||
val HARDENED_GLASS_YELLOW: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/yellow"))
|
||||
|
||||
val MACHINES: TagKey<Block> = BlockTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "machines"))
|
||||
}
|
@ -1,11 +1,9 @@
|
||||
package ru.dbotthepony.mc.otm.registry
|
||||
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.tags.BlockTags
|
||||
import net.minecraft.tags.ItemTags
|
||||
import net.minecraft.tags.TagKey
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.level.block.Block
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
|
||||
@Suppress("unused")
|
||||
@ -38,6 +36,7 @@ object MItemTags {
|
||||
val GOLD_WIRES: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "wires/gold"))
|
||||
|
||||
val PISTONS: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "pistons"))
|
||||
val FURNACES: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "furnaces"))
|
||||
|
||||
val TOOLS_HAMMERS: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "tools/hammers"))
|
||||
|
||||
@ -82,54 +81,3 @@ object MItemTags {
|
||||
val MACHINES: TagKey<Item> = ItemTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "machines"))
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
object MBlockTags {
|
||||
val CARGO_CRATES: TagKey<Block> = BlockTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "cargo_crates"))
|
||||
val INDUSTRIAL_GLASS: TagKey<Block> = BlockTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "industrial_glass"))
|
||||
|
||||
val CRAFTING_TABLES: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "crafting_tables"))
|
||||
val WORKBENCHES: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "workbenches"))
|
||||
val WORKBENCH: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "workbench"))
|
||||
|
||||
val REQUIRES_TRITANIUM_TOOL: TagKey<Block> = BlockTags.create(ResourceLocation("minecraft", "requires_tritanium_tool"))
|
||||
|
||||
val HARDENED_GLASS_PANES: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes"))
|
||||
val HARDENED_GLASS_PANES_BLACK: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/black"))
|
||||
val HARDENED_GLASS_PANES_BLUE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/blue"))
|
||||
val HARDENED_GLASS_PANES_BROWN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/brown"))
|
||||
val HARDENED_GLASS_PANES_COLORLESS: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/colorless"))
|
||||
val HARDENED_GLASS_PANES_CYAN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/cyan"))
|
||||
val HARDENED_GLASS_PANES_GRAY: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/gray"))
|
||||
val HARDENED_GLASS_PANES_GREEN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/green"))
|
||||
val HARDENED_GLASS_PANES_LIGHT_BLUE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/light_blue"))
|
||||
val HARDENED_GLASS_PANES_LIGHT_GRAY: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/light_gray"))
|
||||
val HARDENED_GLASS_PANES_LIME: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/lime"))
|
||||
val HARDENED_GLASS_PANES_MAGENTA: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/magenta"))
|
||||
val HARDENED_GLASS_PANES_ORANGE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/orange"))
|
||||
val HARDENED_GLASS_PANES_PINK: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/pink"))
|
||||
val HARDENED_GLASS_PANES_PURPLE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/purple"))
|
||||
val HARDENED_GLASS_PANES_RED: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/red"))
|
||||
val HARDENED_GLASS_PANES_WHITE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/white"))
|
||||
val HARDENED_GLASS_PANES_YELLOW: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/yellow"))
|
||||
|
||||
val HARDENED_GLASS: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass"))
|
||||
val HARDENED_GLASS_BLACK: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/black"))
|
||||
val HARDENED_GLASS_BLUE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/blue"))
|
||||
val HARDENED_GLASS_BROWN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/brown"))
|
||||
val HARDENED_GLASS_COLORLESS: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/colorless"))
|
||||
val HARDENED_GLASS_CYAN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/cyan"))
|
||||
val HARDENED_GLASS_GRAY: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/gray"))
|
||||
val HARDENED_GLASS_GREEN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/green"))
|
||||
val HARDENED_GLASS_LIGHT_BLUE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/light_blue"))
|
||||
val HARDENED_GLASS_LIGHT_GRAY: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/light_gray"))
|
||||
val HARDENED_GLASS_LIME: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/lime"))
|
||||
val HARDENED_GLASS_MAGENTA: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/magenta"))
|
||||
val HARDENED_GLASS_ORANGE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/orange"))
|
||||
val HARDENED_GLASS_PINK: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/pink"))
|
||||
val HARDENED_GLASS_PURPLE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/purple"))
|
||||
val HARDENED_GLASS_RED: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/red"))
|
||||
val HARDENED_GLASS_WHITE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/white"))
|
||||
val HARDENED_GLASS_YELLOW: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/yellow"))
|
||||
|
||||
val MACHINES: TagKey<Block> = BlockTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "machines"))
|
||||
}
|
@ -116,7 +116,6 @@ object MItems {
|
||||
init {
|
||||
val machines = ArrayList<Supplier<BlockItem>>()
|
||||
|
||||
machines.addAll(PLATE_PRESS.asSupplierArray())
|
||||
machines.addAll(TWIN_PLATE_PRESS.asSupplierArray())
|
||||
machines.addAll(POWERED_FURNACE.asSupplierArray())
|
||||
machines.addAll(POWERED_BLAST_FURNACE.asSupplierArray())
|
||||
|
@ -5,9 +5,7 @@ import net.minecraft.world.flag.FeatureFlags
|
||||
import net.minecraft.world.inventory.MenuType
|
||||
import net.minecraftforge.eventbus.api.IEventBus
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent
|
||||
import net.minecraftforge.registries.DeferredRegister
|
||||
import net.minecraftforge.registries.ForgeRegistries
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.block.entity.tech.AndroidChargerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.client.screen.decorative.CargoCrateScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.decorative.FluidTankScreen
|
||||
@ -38,9 +36,7 @@ import ru.dbotthepony.mc.otm.client.screen.tech.EnergyCounterScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.tech.EnergyServoScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.tech.EssenceStorageScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.decorative.PainterScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.tech.PlatePressScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.tech.PoweredFurnaceScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.tech.TwinPlatePressScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.tech.AbstractProcessingMachineScreen
|
||||
import ru.dbotthepony.mc.otm.menu.decorative.CargoCrateMenu
|
||||
import ru.dbotthepony.mc.otm.menu.decorative.FluidTankMenu
|
||||
import ru.dbotthepony.mc.otm.menu.decorative.HoloSignMenu
|
||||
@ -72,7 +68,6 @@ import ru.dbotthepony.mc.otm.menu.tech.EssenceStorageMenu
|
||||
import ru.dbotthepony.mc.otm.menu.decorative.PainterMenu
|
||||
import ru.dbotthepony.mc.otm.menu.tech.PlatePressMenu
|
||||
import ru.dbotthepony.mc.otm.menu.tech.PoweredFurnaceMenu
|
||||
import ru.dbotthepony.mc.otm.menu.tech.TwinPlatePressMenu
|
||||
|
||||
object MMenus {
|
||||
private val registry = MDeferredRegister(ForgeRegistries.MENU_TYPES)
|
||||
@ -94,11 +89,11 @@ object MMenus {
|
||||
val ITEM_MONITOR by registry.register(MNames.ITEM_MONITOR) { MenuType(::ItemMonitorMenu) }
|
||||
val ENERGY_COUNTER by registry.register(MNames.ENERGY_COUNTER) { MenuType(::EnergyCounterMenu) }
|
||||
val CHEMICAL_GENERATOR by registry.register(MNames.CHEMICAL_GENERATOR) { MenuType(::ChemicalGeneratorMenu) }
|
||||
val PLATE_PRESS by registry.register(MNames.PLATE_PRESS) { MenuType(::PlatePressMenu) }
|
||||
val PLATE_PRESS by registry.register(MNames.PLATE_PRESS) { MenuType(PlatePressMenu::single) }
|
||||
val POWERED_FURNACE by registry.register(MNames.POWERED_FURNACE) { MenuType(PoweredFurnaceMenu::furnace) }
|
||||
val POWERED_BLAST_FURNACE by registry.register(MNames.POWERED_BLAST_FURNACE) { MenuType(PoweredFurnaceMenu::blasting) }
|
||||
val POWERED_SMOKER by registry.register(MNames.POWERED_SMOKER) { MenuType(PoweredFurnaceMenu::smoking) }
|
||||
val TWIN_PLATE_PRESS by registry.register(MNames.TWIN_PLATE_PRESS) { MenuType(::TwinPlatePressMenu) }
|
||||
val TWIN_PLATE_PRESS by registry.register(MNames.TWIN_PLATE_PRESS) { MenuType(PlatePressMenu::twin) }
|
||||
val MATTER_RECYCLER by registry.register(MNames.MATTER_RECYCLER) { MenuType(::MatterRecyclerMenu) }
|
||||
val ENERGY_SERVO by registry.register(MNames.ENERGY_SERVO) { MenuType(::EnergyServoMenu) }
|
||||
val HOLO_SIGN by registry.register(MNames.HOLO_SIGN) { MenuType(::HoloSignMenu) }
|
||||
@ -137,8 +132,8 @@ object MMenus {
|
||||
MenuScreens.register(ITEM_MONITOR, ::ItemMonitorScreen)
|
||||
MenuScreens.register(ENERGY_COUNTER, ::EnergyCounterScreen)
|
||||
MenuScreens.register(CHEMICAL_GENERATOR, ::ChemicalGeneratorScreen)
|
||||
MenuScreens.register(PLATE_PRESS, ::PlatePressScreen)
|
||||
MenuScreens.register(TWIN_PLATE_PRESS, ::TwinPlatePressScreen)
|
||||
MenuScreens.register(PLATE_PRESS, ::AbstractProcessingMachineScreen)
|
||||
MenuScreens.register(TWIN_PLATE_PRESS, ::AbstractProcessingMachineScreen)
|
||||
MenuScreens.register(MATTER_RECYCLER, ::MatterRecyclerScreen)
|
||||
MenuScreens.register(STORAGE_BUS, ::StorageBusScreen)
|
||||
MenuScreens.register(STORAGE_IMPORTER_EXPORTER, ::StorageImporterExporterScreen)
|
||||
@ -149,9 +144,9 @@ object MMenus {
|
||||
MenuScreens.register(ESSENCE_STORAGE, ::EssenceStorageScreen)
|
||||
MenuScreens.register(ITEM_REPAIER, ::MatterReconstructorScreen)
|
||||
MenuScreens.register(FLUID_TANK, ::FluidTankScreen)
|
||||
MenuScreens.register(POWERED_FURNACE, ::PoweredFurnaceScreen)
|
||||
MenuScreens.register(POWERED_BLAST_FURNACE, ::PoweredFurnaceScreen)
|
||||
MenuScreens.register(POWERED_SMOKER, ::PoweredFurnaceScreen)
|
||||
MenuScreens.register(POWERED_FURNACE, ::AbstractProcessingMachineScreen)
|
||||
MenuScreens.register(POWERED_BLAST_FURNACE, ::AbstractProcessingMachineScreen)
|
||||
MenuScreens.register(POWERED_SMOKER, ::AbstractProcessingMachineScreen)
|
||||
MenuScreens.register(PAINTER, ::PainterScreen)
|
||||
MenuScreens.register(MATTER_ENTANGLER, ::MatterEntanglerScreen)
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import net.minecraft.world.item.DyeableArmorItem
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.Items
|
||||
import net.minecraft.world.item.ShieldItem
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.block.*
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour
|
||||
@ -35,7 +36,7 @@ import net.minecraftforge.eventbus.api.IEventBus
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment
|
||||
import net.minecraftforge.registries.DeferredRegister
|
||||
import net.minecraftforge.registries.ForgeRegistries
|
||||
import net.minecraftforge.registries.NewRegistryEvent
|
||||
import net.minecraftforge.registries.RegisterEvent
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
@ -409,8 +410,12 @@ object MRegistry : IBlockItemRegistryAcceptor {
|
||||
}
|
||||
|
||||
private fun registerItemDecorators(event: RegisterItemDecorationsEvent) {
|
||||
event.register(Items.SHIELD) { font, stack, xOffset, yOffset, blitOffset -> MatteryGUI.renderShieldCooldownOverlay(PoseStack(), font, stack, xOffset, yOffset) }
|
||||
|
||||
event.register(MItems.TRITANIUM_SHIELD) { font, stack, xOffset, yOffset, blitOffset -> MatteryGUI.renderShieldCooldownOverlay(PoseStack(), font, stack, xOffset, yOffset) }
|
||||
ForgeRegistries.ITEMS.forEach {
|
||||
if (it is ShieldItem) {
|
||||
event.register(it) { font, stack, xOffset, yOffset, blitOffset ->
|
||||
MatteryGUI.renderShieldCooldownOverlay(PoseStack(), font, stack, xOffset, yOffset)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
|
||||
"pattern": [
|
||||
"R R",
|
||||
"GCG",
|
||||
"PPP"
|
||||
],
|
||||
|
||||
"key": {
|
||||
"C": {
|
||||
"tag": "forge:wires/copper"
|
||||
},
|
||||
|
||||
"R": {
|
||||
"tag": "forge:dusts/redstone"
|
||||
},
|
||||
|
||||
"G": {
|
||||
"tag": "forge:wires/gold"
|
||||
},
|
||||
|
||||
"P": {
|
||||
"item": "overdrive_that_matters:circuit_plating"
|
||||
}
|
||||
},
|
||||
|
||||
"result": {
|
||||
"item": "overdrive_that_matters:advanced_control_circuit",
|
||||
"count": 3
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
|
||||
"pattern": [
|
||||
"CRC",
|
||||
"PPP"
|
||||
],
|
||||
|
||||
"key": {
|
||||
"C": {
|
||||
"tag": "forge:wires/copper"
|
||||
},
|
||||
|
||||
"R": {
|
||||
"tag": "forge:dusts/redstone"
|
||||
},
|
||||
|
||||
"P": {
|
||||
"item": "overdrive_that_matters:circuit_plating"
|
||||
}
|
||||
},
|
||||
|
||||
"result": {
|
||||
"item": "overdrive_that_matters:basic_control_circuit",
|
||||
"count": 3
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
|
||||
"pattern": [
|
||||
" # ",
|
||||
"#@#",
|
||||
" # "
|
||||
],
|
||||
|
||||
"key": {
|
||||
"#": {
|
||||
"tag": "forge:ingots/copper"
|
||||
},
|
||||
|
||||
"@": {
|
||||
"tag": "forge:rods/wooden"
|
||||
}
|
||||
},
|
||||
|
||||
"result": {
|
||||
"item": "overdrive_that_matters:copper_wiring",
|
||||
"count": 8
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
|
||||
"pattern": [
|
||||
"RCR",
|
||||
"GIG",
|
||||
"RCR"
|
||||
],
|
||||
|
||||
"key": {
|
||||
"R": {
|
||||
"tag": "forge:dusts/redstone"
|
||||
},
|
||||
|
||||
"I": {
|
||||
"tag": "forge:ingots/iron"
|
||||
},
|
||||
|
||||
"G": {
|
||||
"tag": "forge:nuggets/gold"
|
||||
},
|
||||
|
||||
"C": {
|
||||
"tag": "forge:wires/copper"
|
||||
}
|
||||
},
|
||||
|
||||
"result": {
|
||||
"item": "overdrive_that_matters:electric_parts",
|
||||
"count": 4
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user