Merge branch '1.20.2' of https://git.dbotthepony.ru/DBot/overdrive_that_matters into 1.20.1
This commit is contained in:
commit
42fe77e6b4
113
machine_colorizer.js
Normal file
113
machine_colorizer.js
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
|
||||||
|
// Использует Image Magick для автоматической перекраски текстур
|
||||||
|
|
||||||
|
const fs = require('fs')
|
||||||
|
const root_main = './src/main/resources/assets/overdrive_that_matters/textures/block/'
|
||||||
|
const child_process = require('child_process')
|
||||||
|
|
||||||
|
const args = process.argv.slice(2)
|
||||||
|
|
||||||
|
if (args.length != 1) {
|
||||||
|
console.error('Usage: <texture name>')
|
||||||
|
process.exit(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
const colors = [
|
||||||
|
['white', [255, 255, 255]],
|
||||||
|
['orange', [245, 116, 16]],
|
||||||
|
['magenta', [186, 63, 175]],
|
||||||
|
['light_blue', [59, 180, 219]],
|
||||||
|
['yellow', [252, 199, 36]],
|
||||||
|
['lime', [111, 187, 24]],
|
||||||
|
['pink', [243, 139, 170]],
|
||||||
|
['gray', [62, 66, 70]],
|
||||||
|
['light_gray', [140, 140, 131]],
|
||||||
|
['cyan', [22, 134, 145]],
|
||||||
|
['purple', [116, 38, 169]],
|
||||||
|
['blue', [51, 53, 155]],
|
||||||
|
['brown', [114, 71, 40]],
|
||||||
|
['green', [84, 109, 28]],
|
||||||
|
['red', [156, 37, 34]],
|
||||||
|
['black', [31, 31, 35]],
|
||||||
|
]
|
||||||
|
|
||||||
|
process.stderr.setMaxListeners(40)
|
||||||
|
process.stdout.setMaxListeners(40)
|
||||||
|
|
||||||
|
async function size(path) {
|
||||||
|
const identify = child_process.spawn('magick', [
|
||||||
|
'identify',
|
||||||
|
path,
|
||||||
|
])
|
||||||
|
|
||||||
|
identify.stderr.pipe(process.stderr)
|
||||||
|
|
||||||
|
const chunks = []
|
||||||
|
identify.stdout.on('data', (a) => chunks.push(a))
|
||||||
|
|
||||||
|
await new Promise((resolve) => {
|
||||||
|
identify.on('close', () => resolve())
|
||||||
|
})
|
||||||
|
|
||||||
|
const chunk = chunks[0].toString('utf-8')
|
||||||
|
const size = chunk.match(/PNG ([0-9]+)x([0-9]+)/)
|
||||||
|
const width = parseInt(size[1])
|
||||||
|
const height = parseInt(size[2])
|
||||||
|
|
||||||
|
return [width, height]
|
||||||
|
}
|
||||||
|
|
||||||
|
(async function() {
|
||||||
|
const textureOverlay = args[0]
|
||||||
|
const textureColor = textureOverlay + '_mask'
|
||||||
|
|
||||||
|
if (!fs.existsSync(`${root_main}${textureOverlay}.png`)) {
|
||||||
|
process.stderr.write(`${textureOverlay}.png does not exist\n`)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fs.existsSync(`${root_main}${textureColor}.png`)) {
|
||||||
|
process.stderr.write(`${textureColor}.png does not exist\n`)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
fs.mkdirSync(`${root_main}/${textureOverlay}`)
|
||||||
|
} catch(err) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const [widthOverlay, heightOverlay] = await size(`${root_main}${textureOverlay}.png`)
|
||||||
|
const [width, height] = await size(`${root_main}${textureColor}.png`)
|
||||||
|
|
||||||
|
if (widthOverlay != width || heightOverlay != height) {
|
||||||
|
process.stderr.write(`${textureColor}.png has size of ${width}x${height}, overlay has size of ${widthOverlay}x${heightOverlay}!\n`)
|
||||||
|
process.exit(3)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const color of colors) {
|
||||||
|
const name = color[0]
|
||||||
|
const rgb = color[1]
|
||||||
|
const magick = child_process.spawn('magick', [
|
||||||
|
'convert',
|
||||||
|
|
||||||
|
`${root_main}${textureOverlay}.png`,
|
||||||
|
|
||||||
|
'(',
|
||||||
|
`${root_main}${textureColor}.png`,
|
||||||
|
'-size', `${width}x${height}`,
|
||||||
|
`xc:rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`,
|
||||||
|
'-channel', 'rgb',
|
||||||
|
'-compose', 'Multiply',
|
||||||
|
'-composite',
|
||||||
|
')',
|
||||||
|
|
||||||
|
'-compose', 'Over',
|
||||||
|
'-composite',
|
||||||
|
|
||||||
|
`${root_main}${textureOverlay}/${name}.png`])
|
||||||
|
|
||||||
|
magick.stdout.pipe(process.stdout)
|
||||||
|
magick.stderr.pipe(process.stderr)
|
||||||
|
}
|
||||||
|
})()
|
@ -36,6 +36,7 @@ import ru.dbotthepony.mc.otm.core.registryName
|
|||||||
import ru.dbotthepony.mc.otm.datagen.advancements.addAdvancements
|
import ru.dbotthepony.mc.otm.datagen.advancements.addAdvancements
|
||||||
import ru.dbotthepony.mc.otm.datagen.advancements.addAndroidAdvancements
|
import ru.dbotthepony.mc.otm.datagen.advancements.addAndroidAdvancements
|
||||||
import ru.dbotthepony.mc.otm.datagen.advancements.addMachineAdvancements
|
import ru.dbotthepony.mc.otm.datagen.advancements.addMachineAdvancements
|
||||||
|
import ru.dbotthepony.mc.otm.datagen.blocks.addBlockModels
|
||||||
import ru.dbotthepony.mc.otm.datagen.blocks.addBlockStates
|
import ru.dbotthepony.mc.otm.datagen.blocks.addBlockStates
|
||||||
import ru.dbotthepony.mc.otm.datagen.blocks.addComplexBlockStates
|
import ru.dbotthepony.mc.otm.datagen.blocks.addComplexBlockStates
|
||||||
import ru.dbotthepony.mc.otm.datagen.items.addItemModels
|
import ru.dbotthepony.mc.otm.datagen.items.addItemModels
|
||||||
@ -43,7 +44,6 @@ import ru.dbotthepony.mc.otm.datagen.lang.AddRussianLanguage
|
|||||||
import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider
|
import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider
|
||||||
import ru.dbotthepony.mc.otm.datagen.loot.*
|
import ru.dbotthepony.mc.otm.datagen.loot.*
|
||||||
import ru.dbotthepony.mc.otm.datagen.loot.LootModifiers
|
import ru.dbotthepony.mc.otm.datagen.loot.LootModifiers
|
||||||
import ru.dbotthepony.mc.otm.datagen.models.addBlockModels
|
|
||||||
import ru.dbotthepony.mc.otm.datagen.recipes.*
|
import ru.dbotthepony.mc.otm.datagen.recipes.*
|
||||||
import ru.dbotthepony.mc.otm.datagen.tags.TagsProvider
|
import ru.dbotthepony.mc.otm.datagen.tags.TagsProvider
|
||||||
import ru.dbotthepony.mc.otm.datagen.tags.addTags
|
import ru.dbotthepony.mc.otm.datagen.tags.addTags
|
||||||
@ -516,8 +516,10 @@ object DataGen {
|
|||||||
event.generator.addProvider(event.includeServer(), blockStateProvider)
|
event.generator.addProvider(event.includeServer(), blockStateProvider)
|
||||||
event.generator.addProvider(event.includeClient(), itemModelProvider)
|
event.generator.addProvider(event.includeClient(), itemModelProvider)
|
||||||
event.generator.addProvider(event.includeServer(), recipeProvider)
|
event.generator.addProvider(event.includeServer(), recipeProvider)
|
||||||
event.generator.addProvider(event.includeClient(), MatterBankProvider(event))
|
DyeColor.entries.forEach { event.generator.addProvider(event.includeClient(), MatterBankProvider(event, it)) }
|
||||||
event.generator.addProvider(event.includeClient(), BatteryBankProvider(event))
|
event.generator.addProvider(event.includeClient(), MatterBankProvider(event, null))
|
||||||
|
DyeColor.entries.forEach { event.generator.addProvider(event.includeClient(), BatteryBankProvider(event, it)) }
|
||||||
|
event.generator.addProvider(event.includeClient(), BatteryBankProvider(event, null))
|
||||||
event.generator.addProvider(event.includeServer(), lootTableProvider)
|
event.generator.addProvider(event.includeServer(), lootTableProvider)
|
||||||
event.generator.addProvider(event.includeServer(), lootModifier)
|
event.generator.addProvider(event.includeServer(), lootModifier)
|
||||||
event.generator.addProvider(event.includeServer(), SoundDataProvider(event))
|
event.generator.addProvider(event.includeServer(), SoundDataProvider(event))
|
||||||
|
@ -140,6 +140,14 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
|
|||||||
blockModelProvider.decorativeGlassAll(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
|
blockModelProvider.decorativeGlassAll(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
|
||||||
blockStateProvider.simpleBlockM(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
|
blockStateProvider.simpleBlockM(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
|
||||||
|
|
||||||
|
blockModelProvider.colored("computer_terminal", mapOf(
|
||||||
|
"0" to "decorative/computer_base",
|
||||||
|
"1" to "decorative/computer_screen",
|
||||||
|
"particle" to "decorative/computer_base",
|
||||||
|
))
|
||||||
|
|
||||||
|
blockStateProvider.block(MRegistry.COMPUTER_TERMINAL.allBlocks.values)
|
||||||
|
|
||||||
blockStateProvider.simpleBlockM(MBlocks.FLUID_TANK)
|
blockStateProvider.simpleBlockM(MBlocks.FLUID_TANK)
|
||||||
|
|
||||||
for ((block, colors) in MRegistry.TRITANIUM_STRIPED_BLOCK.blocksWithColor) {
|
for ((block, colors) in MRegistry.TRITANIUM_STRIPED_BLOCK.blocksWithColor) {
|
||||||
|
@ -89,6 +89,23 @@ fun addMatterData(provider: MatterDataProvider) {
|
|||||||
provider.inherit(Items.RED_CONCRETE, Items.RED_CONCRETE_POWDER)
|
provider.inherit(Items.RED_CONCRETE, Items.RED_CONCRETE_POWDER)
|
||||||
provider.inherit(Items.BLACK_CONCRETE, Items.BLACK_CONCRETE_POWDER)
|
provider.inherit(Items.BLACK_CONCRETE, Items.BLACK_CONCRETE_POWDER)
|
||||||
|
|
||||||
|
provider.inherit(Items.WHITE_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.ORANGE_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.MAGENTA_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.LIGHT_BLUE_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.YELLOW_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.LIME_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.PINK_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.GRAY_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.LIGHT_GRAY_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.CYAN_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.PURPLE_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.BLUE_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.BROWN_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.GREEN_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.RED_WOOL, Items.STRING, Decimal(4))
|
||||||
|
provider.inherit(Items.BLACK_WOOL, Items.STRING, Decimal(4))
|
||||||
|
|
||||||
with(provider) {
|
with(provider) {
|
||||||
blacklist(Tags.Items.RAW_MATERIALS)
|
blacklist(Tags.Items.RAW_MATERIALS)
|
||||||
blacklist(Tags.Items.RAW_MATERIALS_COPPER)
|
blacklist(Tags.Items.RAW_MATERIALS_COPPER)
|
||||||
|
@ -146,7 +146,7 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
|
|||||||
val researchAnything = AdvancementBuilder()
|
val researchAnything = AdvancementBuilder()
|
||||||
.parent(root)
|
.parent(root)
|
||||||
.display(
|
.display(
|
||||||
itemStack = ItemStack(MItems.ANDROID_STATION),
|
itemStack = ItemStack(MItems.ANDROID_STATION[null]!!),
|
||||||
title = translation.add("research_anything", "New Trick") {
|
title = translation.add("research_anything", "New Trick") {
|
||||||
russian("Новый фокус")
|
russian("Новый фокус")
|
||||||
},
|
},
|
||||||
@ -298,7 +298,7 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
|
|||||||
AdvancementBuilder()
|
AdvancementBuilder()
|
||||||
.parent(researchAnything)
|
.parent(researchAnything)
|
||||||
.display(
|
.display(
|
||||||
itemStack = ItemStack(MItems.ANDROID_STATION),
|
itemStack = ItemStack(MItems.ANDROID_STATION[null]!!),
|
||||||
title = translation.add("research_all", "Mecha-Agnomination") {
|
title = translation.add("research_all", "Mecha-Agnomination") {
|
||||||
russian("Меха-зумие")
|
russian("Меха-зумие")
|
||||||
},
|
},
|
||||||
|
@ -18,15 +18,23 @@ import java.util.function.Consumer
|
|||||||
typealias AdvancementHolder = Advancement
|
typealias AdvancementHolder = Advancement
|
||||||
|
|
||||||
private data class CraftEntry(
|
private data class CraftEntry(
|
||||||
val item: Item,
|
val item: Collection<Item>,
|
||||||
val englishName: String,
|
val englishName: String,
|
||||||
val englishSuffix: String? = null,
|
val englishSuffix: String? = null,
|
||||||
|
|
||||||
val russianName: String? = null,
|
val russianName: String? = null,
|
||||||
val russianSuffix: String? = null,
|
val russianSuffix: String? = null,
|
||||||
) {
|
) {
|
||||||
|
constructor(
|
||||||
|
item: Item,
|
||||||
|
englishName: String,
|
||||||
|
englishSuffix: String? = null,
|
||||||
|
russianName: String? = null,
|
||||||
|
russianSuffix: String? = null,
|
||||||
|
) : this(listOf(item), englishName, englishSuffix, russianName, russianSuffix)
|
||||||
|
|
||||||
fun make(serializer: Consumer<AdvancementHolder>, parent: AdvancementHolder, translation: MatteryLanguageProvider.MultiBuilder): AdvancementHolder {
|
fun make(serializer: Consumer<AdvancementHolder>, parent: AdvancementHolder, translation: MatteryLanguageProvider.MultiBuilder): AdvancementHolder {
|
||||||
val path = item.registryName!!.path
|
val path = item.first().registryName!!.path
|
||||||
|
|
||||||
val translated = translation.add("$path.desc", "Craft a %s%s") {
|
val translated = translation.add("$path.desc", "Craft a %s%s") {
|
||||||
russian("Создайте %s%s")
|
russian("Создайте %s%s")
|
||||||
@ -39,15 +47,20 @@ private data class CraftEntry(
|
|||||||
return AdvancementBuilder()
|
return AdvancementBuilder()
|
||||||
.parent(parent)
|
.parent(parent)
|
||||||
.display(
|
.display(
|
||||||
itemStack = ItemStack(item),
|
itemStack = ItemStack(item.first()),
|
||||||
title = translation.add(path, englishName) {
|
title = translation.add(path, englishName) {
|
||||||
if (russianName != null) {
|
if (russianName != null) {
|
||||||
russian(russianName)
|
russian(russianName)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
description = TranslatableComponent(translated.contents.key, item.description, translatedSuffix),
|
description = TranslatableComponent(translated.contents.key, item.first().description, translatedSuffix),
|
||||||
)
|
)
|
||||||
.addCriterion("has_machine", criterion(item))
|
.also {
|
||||||
|
for ((i, item) in item.withIndex()) {
|
||||||
|
it.addCriterion(i.toString(), criterion(item))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.requirements(AdvancementRequirements.Strategy.OR)
|
||||||
.save(serializer, modLocation("machines/$path"))
|
.save(serializer, modLocation("machines/$path"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,7 +85,7 @@ fun addMachineAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
|
|||||||
val press = AdvancementBuilder()
|
val press = AdvancementBuilder()
|
||||||
.parent(chem)
|
.parent(chem)
|
||||||
.display(
|
.display(
|
||||||
itemStack = ItemStack(MItems.PLATE_PRESS),
|
itemStack = ItemStack(MItems.PLATE_PRESS[null]!!),
|
||||||
title = translation.add("plate_press", "Bending the Material") {
|
title = translation.add("plate_press", "Bending the Material") {
|
||||||
russian("Раскатка металла")
|
russian("Раскатка металла")
|
||||||
},
|
},
|
||||||
@ -80,36 +93,40 @@ fun addMachineAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
|
|||||||
russian("Создайте пресс пластин, не суйте свои или чужие конечности внутрь")
|
russian("Создайте пресс пластин, не суйте свои или чужие конечности внутрь")
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.addCriterion("has_machine", criterion(MItems.PLATE_PRESS))
|
.also {
|
||||||
|
for ((i, m) in MItems.PLATE_PRESS.values.withIndex())
|
||||||
|
it.addCriterion(i.toString(), criterion(m))
|
||||||
|
}
|
||||||
|
.requirements(AdvancementRequirements.Strategy.OR)
|
||||||
.save(serializer, modLocation("machines/plate_press"))
|
.save(serializer, modLocation("machines/plate_press"))
|
||||||
|
|
||||||
CraftEntry(MItems.TWIN_PLATE_PRESS, "Twice the Thud",
|
CraftEntry(MItems.TWIN_PLATE_PRESS.values, "Twice the Thud",
|
||||||
russianName = "Двойной стук").make(serializer, press, translation)
|
russianName = "Двойной стук").make(serializer, press, translation)
|
||||||
|
|
||||||
val scanner = CraftEntry(MItems.MATTER_SCANNER, "Scanning Things that Matter",
|
val scanner = CraftEntry(MItems.MATTER_SCANNER.values, "Scanning Things that Matter",
|
||||||
russianName = "Сканируем вещи которые материальны")
|
russianName = "Сканируем вещи которые материальны")
|
||||||
val decomposer = CraftEntry(MItems.MATTER_DECOMPOSER, "Decaying the Atoms", "Keep your limbs outside of the working chamber at all times",
|
val decomposer = CraftEntry(MItems.MATTER_DECOMPOSER.values, "Decaying the Atoms", "Keep your limbs outside of the working chamber at all times",
|
||||||
russianName = "Разлагаем атомы", russianSuffix = "Во всех ситуациях держите свои конечности вне рабочей камеры")
|
russianName = "Разлагаем атомы", russianSuffix = "Во всех ситуациях держите свои конечности вне рабочей камеры")
|
||||||
val panel = CraftEntry(MItems.MATTER_PANEL, "Indexing the Library",
|
val panel = CraftEntry(MItems.MATTER_PANEL, "Indexing the Library",
|
||||||
russianName = "Индексируем библиотеку")
|
russianName = "Индексируем библиотеку")
|
||||||
val replicator = CraftEntry(MItems.MATTER_REPLICATOR, "Cook with (Im)Perfection", "Now let's bake some perfect bread",
|
val replicator = CraftEntry(MItems.MATTER_REPLICATOR.values, "Cook with (Im)Perfection", "Now let's bake some perfect bread",
|
||||||
russianName = "Повар с (не) идеальностями", russianSuffix = "А теперь давайте выпечем немного идеального хлеба")
|
russianName = "Повар с (не) идеальностями", russianSuffix = "А теперь давайте выпечем немного идеального хлеба")
|
||||||
val bottler = CraftEntry(MItems.MATTER_BOTTLER, "Transfusing Pure Matter", "For those who loved to play with water in their childhood",
|
val bottler = CraftEntry(MItems.MATTER_BOTTLER.values, "Transfusing Pure Matter", "For those who loved to play with water in their childhood",
|
||||||
russianName = "Переливаем чистую материю", russianSuffix = "Для тех, кто любил играться в воде в детстве")
|
russianName = "Переливаем чистую материю", russianSuffix = "Для тех, кто любил играться в воде в детстве")
|
||||||
val recycler = CraftEntry(MItems.MATTER_RECYCLER, "Refine and Redefine", "This is what waste recycling should look like",
|
val recycler = CraftEntry(MItems.MATTER_RECYCLER.values, "Refine and Redefine", "This is what waste recycling should look like",
|
||||||
russianName = "Переработка и перегонка", russianSuffix = "Вот он, пик переработки отходов")
|
russianName = "Переработка и перегонка", russianSuffix = "Вот он, пик переработки отходов")
|
||||||
val capacitor = CraftEntry(MItems.MATTER_CAPACITOR_BANK, "Modular Matter Tank",
|
val capacitor = CraftEntry(MItems.MATTER_CAPACITOR_BANK.values, "Modular Matter Tank",
|
||||||
russianName = "Модульный бак материи")
|
russianName = "Модульный бак материи")
|
||||||
|
|
||||||
val counter = CraftEntry(MItems.ENERGY_COUNTER, "Visualize Power Burn",
|
val counter = CraftEntry(MItems.ENERGY_COUNTER, "Visualize Power Burn",
|
||||||
russianName = "Визуализация сжигания энергии")
|
russianName = "Визуализация сжигания энергии")
|
||||||
val battery = CraftEntry(MItems.BATTERY_BANK, "Batteries Not Included", "By all means avoid the urge to hammer incompatible batteries into the power bus.",
|
val battery = CraftEntry(MItems.BATTERY_BANK.values, "Batteries Not Included", "By all means avoid the urge to hammer incompatible batteries into the power bus.",
|
||||||
russianName = "Батарейки в комплект не входят", russianSuffix = "Пожалуйста, воздержитесь от вбивания кувалдой несовместимых батарей в энергетическую шину.")
|
russianName = "Батарейки в комплект не входят", russianSuffix = "Пожалуйста, воздержитесь от вбивания кувалдой несовместимых батарей в энергетическую шину.")
|
||||||
|
|
||||||
val pattern = CraftEntry(MItems.PATTERN_STORAGE, "Digital Knowledge Library",
|
val pattern = CraftEntry(MItems.PATTERN_STORAGE, "Digital Knowledge Library",
|
||||||
russianName = "Цифровая библиотека знаний")
|
russianName = "Цифровая библиотека знаний")
|
||||||
|
|
||||||
val reconstructor = CraftEntry(MItems.MATTER_RECONSTRUCTOR, "Flipping Hourglass",
|
val reconstructor = CraftEntry(MItems.MATTER_RECONSTRUCTOR.values, "Flipping Hourglass",
|
||||||
russianName = "Переворачиваем песочные часы")
|
russianName = "Переворачиваем песочные часы")
|
||||||
|
|
||||||
decomposer.make(serializer, press, translation).also {
|
decomposer.make(serializer, press, translation).also {
|
||||||
@ -161,7 +178,7 @@ fun addMachineAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
|
|||||||
battery.make(serializer, it, translation)
|
battery.make(serializer, it, translation)
|
||||||
}
|
}
|
||||||
|
|
||||||
val station = CraftEntry(MItems.ANDROID_STATION, "Android Home Page",
|
val station = CraftEntry(MItems.ANDROID_STATION.values, "Android Home Page",
|
||||||
russianName = "Домашняя страница андроидов",
|
russianName = "Домашняя страница андроидов",
|
||||||
russianSuffix = "Только пользоваться этим устройством могут вёдра с болтами",
|
russianSuffix = "Только пользоваться этим устройством могут вёдра с болтами",
|
||||||
englishSuffix = "Except only buckets of bolts can use this thing")
|
englishSuffix = "Except only buckets of bolts can use this thing")
|
||||||
@ -173,21 +190,21 @@ fun addMachineAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
|
|||||||
charger.make(serializer, it, translation)
|
charger.make(serializer, it, translation)
|
||||||
}
|
}
|
||||||
|
|
||||||
CraftEntry(MItems.COBBLESTONE_GENERATOR, "Cobblestone: Infinity + 1",
|
CraftEntry(MItems.COBBLESTONE_GENERATOR.values, "Cobblestone: Infinity + 1",
|
||||||
russianName = "Булыжник: бесконечность + 1",
|
russianName = "Булыжник: бесконечность + 1",
|
||||||
russianSuffix = "Смотрите, чтоб он не просыпался во все сундуки",
|
russianSuffix = "Смотрите, чтоб он не просыпался во все сундуки",
|
||||||
englishSuffix = "Watch for not to spill it over all your chests").make(serializer, press, translation)
|
englishSuffix = "Watch for not to spill it over all your chests").make(serializer, press, translation)
|
||||||
|
|
||||||
CraftEntry(MItems.POWERED_FURNACE, "One Big Resistor",
|
CraftEntry(MItems.POWERED_FURNACE.values, "One Big Resistor",
|
||||||
russianName = "Один большой резистор",
|
russianName = "Один большой резистор",
|
||||||
russianSuffix = "Каждый элемент электрической цепи способен испускать свет и тепло, единожды.",
|
russianSuffix = "Каждый элемент электрической цепи способен испускать свет и тепло, единожды.",
|
||||||
englishSuffix = "Any electrical element can emit light and heat, once.")
|
englishSuffix = "Any electrical element can emit light and heat, once.")
|
||||||
.make(serializer, press, translation)
|
.make(serializer, press, translation)
|
||||||
.also {
|
.also {
|
||||||
CraftEntry(MItems.POWERED_BLAST_FURNACE, "Big Microwave Oven",
|
CraftEntry(MItems.POWERED_BLAST_FURNACE.values, "Big Microwave Oven",
|
||||||
russianName = "Большая микроволновая печь").make(serializer, it, translation)
|
russianName = "Большая микроволновая печь").make(serializer, it, translation)
|
||||||
|
|
||||||
CraftEntry(MItems.POWERED_SMOKER, "Small Microwave Oven",
|
CraftEntry(MItems.POWERED_SMOKER.values, "Small Microwave Oven",
|
||||||
russianName = "Маленькая микроволновая печь").make(serializer, it, translation)
|
russianName = "Маленькая микроволновая печь").make(serializer, it, translation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.datagen.blocks
|
package ru.dbotthepony.mc.otm.datagen.blocks
|
||||||
|
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraftforge.client.model.generators.BlockStateProvider
|
import net.minecraftforge.client.model.generators.BlockStateProvider
|
||||||
import net.minecraftforge.client.model.generators.ConfiguredModel
|
import net.minecraftforge.client.model.generators.ConfiguredModel
|
||||||
@ -18,16 +19,16 @@ private fun nothingOrNumber(input: Int): String {
|
|||||||
return (input - 1).toString()
|
return (input - 1).toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
open class BatteryBankProvider(event: GatherDataEvent) : BlockStateProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) {
|
open class BatteryBankProvider(event: GatherDataEvent, val color: DyeColor?) : BlockStateProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) {
|
||||||
protected var block = "battery_bank"
|
protected var block = "battery_bank"
|
||||||
protected var batteryPath = "block/battery/battery"
|
protected var batteryPath = "block/battery/battery"
|
||||||
protected var registry: Block = MBlocks.BATTERY_BANK
|
protected var registry: Block = MBlocks.BATTERY_BANK[color]!!
|
||||||
|
|
||||||
override fun registerStatesAndModels() {
|
override fun registerStatesAndModels() {
|
||||||
with(getVariantBuilder(registry)) {
|
with(getVariantBuilder(registry)) {
|
||||||
forAllStates {
|
forAllStates {
|
||||||
ConfiguredModel.builder()
|
ConfiguredModel.builder()
|
||||||
.modelFile(models().getExistingFile(modLocation("block/$block")))
|
.modelFile(models().getExistingFile(modLocation("block/$block${if (color != null) "_${color.name.lowercase()}" else ""}")))
|
||||||
.rotationY(it[BlockRotationFreedom.HORIZONTAL.property].front.yRotationBlockstateNorth())
|
.rotationY(it[BlockRotationFreedom.HORIZONTAL.property].front.yRotationBlockstateNorth())
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
@ -35,18 +36,18 @@ open class BatteryBankProvider(event: GatherDataEvent) : BlockStateProvider(even
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getName(): String {
|
override fun getName(): String {
|
||||||
return "Battery Bank Model Provider"
|
return "Battery Bank Model Provider for color $color"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MatterBankProvider(event: GatherDataEvent) : BatteryBankProvider(event) {
|
class MatterBankProvider(event: GatherDataEvent, color: DyeColor?) : BatteryBankProvider(event, color) {
|
||||||
init {
|
init {
|
||||||
block = "matter_capacitor_bank"
|
block = "matter_capacitor_bank"
|
||||||
batteryPath = "block/battery/matter_capacitor"
|
batteryPath = "block/battery/matter_capacitor"
|
||||||
registry = MBlocks.MATTER_CAPACITOR_BANK
|
registry = MBlocks.MATTER_CAPACITOR_BANK[color]!!
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getName(): String {
|
override fun getName(): String {
|
||||||
return "Matter Bank Model Provider"
|
return "Matter Bank Model Provider for color $color"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.datagen.blocks
|
||||||
|
|
||||||
|
import ru.dbotthepony.mc.otm.datagen.models.MatteryBlockModelProvider
|
||||||
|
import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||||
|
|
||||||
|
fun addBlockModels(provider: MatteryBlockModelProvider) {
|
||||||
|
with(provider) {
|
||||||
|
resourceCubeAll(MBlocks.TRITANIUM_ORE)
|
||||||
|
resourceCubeAll(MBlocks.TRITANIUM_RAW_BLOCK)
|
||||||
|
resourceCubeAll(MBlocks.DEEPSLATE_TRITANIUM_ORE)
|
||||||
|
resourceCubeAll(MBlocks.TRITANIUM_INGOT_BLOCK)
|
||||||
|
|
||||||
|
colored(MBlocks.COBBLESTONE_GENERATOR, listOf("0", "particle"))
|
||||||
|
colored(MBlocks.ESSENCE_STORAGE, listOf("0", "particle"))
|
||||||
|
colored(MBlocks.ITEM_MONITOR, listOf("0", "particle"))
|
||||||
|
colored(MBlocks.MATTER_RECONSTRUCTOR, listOf("0", "particle"))
|
||||||
|
|
||||||
|
colored("matter_capacitor_bank", listOf("1", "particle"), "mattercapacitorbank_frame")
|
||||||
|
colored("battery_bank", listOf("1", "particle"), "batterybank_frame")
|
||||||
|
|
||||||
|
coloredMachineCombined("plate_press", "plate_press2", listOf("0", "particle"))
|
||||||
|
coloredMachineCombined("twin_plate_press", "plate_press2", listOf("0", "particle"))
|
||||||
|
|
||||||
|
coloredMachineCombined("matter_recycler", listOf("0", "particle"))
|
||||||
|
coloredMachineCombined("matter_scanner", listOf("texture", "particle"))
|
||||||
|
coloredMachineCombined("matter_bottler", listOf("texture", "particle"))
|
||||||
|
coloredMachineCombined("matter_decomposer", listOf("texture", "particle"))
|
||||||
|
coloredMachineCombined("matter_recycler", listOf("0", "particle"))
|
||||||
|
|
||||||
|
colored("matter_replicator", "_idle", mapOf("1" to "matter_replicator_base", "particle" to "matter_replicator_base", "texture" to "matter_replicator_offline"))
|
||||||
|
colored("matter_replicator", "_error", mapOf("1" to "matter_replicator_base", "particle" to "matter_replicator_base", "texture" to "matter_replicator_halted"))
|
||||||
|
colored("matter_replicator", "_working", mapOf("1" to "matter_replicator_base", "particle" to "matter_replicator_base", "texture" to "matter_replicator"))
|
||||||
|
|
||||||
|
colored("powered_smoker", "_idle", mapOf("0" to "powered_smoker_base", "1" to "powered_smoker_interior_0", "particle" to "powered_smoker_base"))
|
||||||
|
colored("powered_smoker", "_error", mapOf("0" to "powered_smoker_base", "1" to "powered_smoker_interior_2", "particle" to "powered_smoker_base"))
|
||||||
|
colored("powered_smoker", "_working", mapOf("0" to "powered_smoker_base", "1" to "powered_smoker_interior_1", "particle" to "powered_smoker_base"))
|
||||||
|
|
||||||
|
colored("powered_furnace", "_idle", mapOf("0" to "electric_furnace_offline", "particle" to "electric_furnace_offline"))
|
||||||
|
colored("powered_furnace", "_error", mapOf("0" to "electric_furnace_offline", "particle" to "electric_furnace_offline"))
|
||||||
|
colored("powered_furnace", "_working", mapOf("0" to "electric_furnace", "particle" to "electric_furnace"))
|
||||||
|
|
||||||
|
colored("powered_blast_furnace", "_idle", mapOf("texture" to "induction_furnace_offline", "particle" to "induction_furnace_offline"))
|
||||||
|
colored("powered_blast_furnace", "_error", mapOf("texture" to "induction_furnace_offline", "particle" to "induction_furnace_offline"))
|
||||||
|
colored("powered_blast_furnace", "_working", mapOf("texture" to "induction_furnace", "particle" to "induction_furnace"))
|
||||||
|
|
||||||
|
colored("android_station", "_idle", mapOf("1" to "android_station_base", "particle" to "android_station_base"))
|
||||||
|
colored("android_station", "_working", mapOf("2" to "android_station_base", "particle" to "android_station_base"))
|
||||||
|
}
|
||||||
|
}
|
@ -21,7 +21,7 @@ import ru.dbotthepony.mc.otm.registry.MRegistry
|
|||||||
|
|
||||||
fun addBlockStates(provider: MatteryBlockStateProvider) {
|
fun addBlockStates(provider: MatteryBlockStateProvider) {
|
||||||
provider.block(MBlocks.BLACK_HOLE)
|
provider.block(MBlocks.BLACK_HOLE)
|
||||||
provider.block(MBlocks.ANDROID_STATION)
|
provider.block(MBlocks.ANDROID_STATION.values)
|
||||||
|
|
||||||
provider.ore(MBlocks.DEEPSLATE_TRITANIUM_ORE)
|
provider.ore(MBlocks.DEEPSLATE_TRITANIUM_ORE)
|
||||||
provider.ore(MBlocks.TRITANIUM_ORE)
|
provider.ore(MBlocks.TRITANIUM_ORE)
|
||||||
@ -30,8 +30,8 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
|
|||||||
provider.block(MBlocks.METAL_MESH)
|
provider.block(MBlocks.METAL_MESH)
|
||||||
|
|
||||||
provider.block(MBlocks.CHEMICAL_GENERATOR)
|
provider.block(MBlocks.CHEMICAL_GENERATOR)
|
||||||
provider.block(MBlocks.MATTER_SCANNER)
|
provider.block(MBlocks.MATTER_SCANNER.values)
|
||||||
provider.block(MBlocks.ITEM_MONITOR)
|
provider.block(MBlocks.ITEM_MONITOR.values)
|
||||||
provider.block(MBlocks.HOLO_SIGN)
|
provider.block(MBlocks.HOLO_SIGN)
|
||||||
|
|
||||||
provider.exec {
|
provider.exec {
|
||||||
@ -59,7 +59,8 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
with(provider.getMultipartBuilder(MBlocks.MATTER_BOTTLER)) {
|
for (block in MBlocks.MATTER_BOTTLER.values) {
|
||||||
|
with(provider.getMultipartBuilder(block)) {
|
||||||
for (dir in BlockRotationFreedom.HORIZONTAL.possibleValues) {
|
for (dir in BlockRotationFreedom.HORIZONTAL.possibleValues) {
|
||||||
for (enum in WorkerState.SEMI_WORKER_STATE.possibleValues) {
|
for (enum in WorkerState.SEMI_WORKER_STATE.possibleValues) {
|
||||||
part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name.lowercase()}")))
|
part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name.lowercase()}")))
|
||||||
@ -90,24 +91,25 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
provider.block(MBlocks.MATTER_DECOMPOSER)
|
provider.block(MBlocks.MATTER_DECOMPOSER.values)
|
||||||
provider.block(MBlocks.MATTER_REPLICATOR)
|
provider.block(MBlocks.MATTER_REPLICATOR.values)
|
||||||
provider.block(MBlocks.PLATE_PRESS)
|
provider.block(MBlocks.PLATE_PRESS.values)
|
||||||
provider.block(MBlocks.TWIN_PLATE_PRESS)
|
provider.block(MBlocks.TWIN_PLATE_PRESS.values)
|
||||||
provider.block(MBlocks.GRAVITATION_STABILIZER)
|
provider.block(MBlocks.GRAVITATION_STABILIZER)
|
||||||
provider.block(MBlocks.GRAVITATION_STABILIZER_LENS)
|
provider.block(MBlocks.GRAVITATION_STABILIZER_LENS)
|
||||||
|
|
||||||
provider.block(MBlocks.POWERED_BLAST_FURNACE)
|
provider.block(MBlocks.POWERED_BLAST_FURNACE.values)
|
||||||
provider.block(MBlocks.POWERED_FURNACE)
|
provider.block(MBlocks.POWERED_FURNACE.values)
|
||||||
provider.block(MBlocks.POWERED_SMOKER)
|
provider.block(MBlocks.POWERED_SMOKER.values)
|
||||||
|
|
||||||
provider.block(MBlocks.STORAGE_POWER_SUPPLIER)
|
provider.block(MBlocks.STORAGE_POWER_SUPPLIER)
|
||||||
provider.block(MBlocks.MATTER_RECYCLER)
|
provider.block(MBlocks.MATTER_RECYCLER.values)
|
||||||
provider.block(MBlocks.MATTER_RECONSTRUCTOR)
|
provider.block(MBlocks.MATTER_RECONSTRUCTOR.values)
|
||||||
provider.block(MBlocks.ENERGY_SERVO)
|
provider.block(MBlocks.ENERGY_SERVO)
|
||||||
provider.block(MBlocks.COBBLESTONE_GENERATOR)
|
provider.block(MBlocks.COBBLESTONE_GENERATOR.values)
|
||||||
provider.block(MBlocks.ESSENCE_STORAGE)
|
provider.block(MBlocks.ESSENCE_STORAGE.values)
|
||||||
|
|
||||||
provider.exec {
|
provider.exec {
|
||||||
for (crate in MRegistry.CARGO_CRATES.allBlocks.values) {
|
for (crate in MRegistry.CARGO_CRATES.allBlocks.values) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.datagen.blocks
|
package ru.dbotthepony.mc.otm.datagen.blocks
|
||||||
|
|
||||||
import net.minecraft.core.Direction
|
import net.minecraft.core.Direction
|
||||||
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraft.world.level.block.RotatedPillarBlock
|
import net.minecraft.world.level.block.RotatedPillarBlock
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
@ -56,10 +57,10 @@ class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(eve
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun block(block: Block, func: BlockStateTransform) = exec {
|
fun block(block: Block, model: String = "block/${block.registryName!!.path}", func: BlockStateTransform = EMPTY) = exec {
|
||||||
getVariantBuilder(block).forAllStates {
|
getVariantBuilder(block).forAllStates {
|
||||||
val builder = ConfiguredModel.builder()
|
val builder = ConfiguredModel.builder()
|
||||||
var modelPath = initialTransform(it, "block/${block.registryName!!.path}", builder)
|
var modelPath = initialTransform(it, model, builder)
|
||||||
modelPath = func(it, builder, modelPath) ?: modelPath
|
modelPath = func(it, builder, modelPath) ?: modelPath
|
||||||
|
|
||||||
builder.modelFile(models().getExistingFile(modLocation(modelPath)))
|
builder.modelFile(models().getExistingFile(modLocation(modelPath)))
|
||||||
@ -70,7 +71,7 @@ class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(eve
|
|||||||
|
|
||||||
fun block(blocks: Collection<Block>): MatteryBlockStateProvider {
|
fun block(blocks: Collection<Block>): MatteryBlockStateProvider {
|
||||||
for (block in blocks) {
|
for (block in blocks) {
|
||||||
this.block(block, EMPTY)
|
this.block(block)
|
||||||
}
|
}
|
||||||
|
|
||||||
return this
|
return this
|
||||||
@ -78,7 +79,7 @@ class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(eve
|
|||||||
|
|
||||||
fun block(vararg blocks: Block): MatteryBlockStateProvider {
|
fun block(vararg blocks: Block): MatteryBlockStateProvider {
|
||||||
for (block in blocks) {
|
for (block in blocks) {
|
||||||
this.block(block, EMPTY)
|
block(block)
|
||||||
}
|
}
|
||||||
|
|
||||||
return this
|
return this
|
||||||
@ -86,11 +87,16 @@ class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(eve
|
|||||||
|
|
||||||
fun simpleBlockM(vararg blocks: Block): MatteryBlockStateProvider {
|
fun simpleBlockM(vararg blocks: Block): MatteryBlockStateProvider {
|
||||||
for (block in blocks) {
|
for (block in blocks) {
|
||||||
|
simpleBlockM(block)
|
||||||
|
}
|
||||||
|
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun simpleBlockM(block: Block, model: ResourceLocation = checkNotNull(block.registryName) {"$block registry name is null!"}): MatteryBlockStateProvider {
|
||||||
exec {
|
exec {
|
||||||
getVariantBuilder(block).forAllStates {
|
getVariantBuilder(block).forAllStates {
|
||||||
check(block.registryName != null) {"$block registry name is null!"}
|
return@forAllStates arrayOf(ConfiguredModel(models().getExistingFile(model)))
|
||||||
return@forAllStates arrayOf(ConfiguredModel(models().getExistingFile(block.registryName)))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@ import ru.dbotthepony.mc.otm.registry.MItems
|
|||||||
import ru.dbotthepony.mc.otm.registry.MRegistry
|
import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||||
|
|
||||||
fun addItemModels(provider: MatteryItemModelProvider) {
|
fun addItemModels(provider: MatteryItemModelProvider) {
|
||||||
provider.block(MItems.ANDROID_STATION, "android_station_working")
|
provider.coloredWithBaseBlock(MItems.ANDROID_STATION, "android_station", "_working")
|
||||||
provider.block(MItems.BATTERY_BANK)
|
provider.coloredWithBaseBlock(MItems.BATTERY_BANK, "matter_capacitor_bank")
|
||||||
provider.block(MItems.MATTER_CAPACITOR_BANK)
|
provider.coloredWithBaseBlock(MItems.MATTER_CAPACITOR_BANK, "matter_capacitor_bank")
|
||||||
provider.block(MItems.PATTERN_STORAGE)
|
provider.block(MItems.PATTERN_STORAGE)
|
||||||
|
|
||||||
provider.exec {
|
provider.exec {
|
||||||
@ -28,13 +28,14 @@ fun addItemModels(provider: MatteryItemModelProvider) {
|
|||||||
provider.block(MItems.TRITANIUM_STRIPED_BLOCK)
|
provider.block(MItems.TRITANIUM_STRIPED_BLOCK)
|
||||||
provider.block(MItems.TRITANIUM_RAW_BLOCK)
|
provider.block(MItems.TRITANIUM_RAW_BLOCK)
|
||||||
provider.block(MItems.TRITANIUM_INGOT_BLOCK)
|
provider.block(MItems.TRITANIUM_INGOT_BLOCK)
|
||||||
provider.block(MItems.ITEM_MONITOR)
|
provider.coloredWithBaseBlock(MItems.ITEM_MONITOR, "item_monitor")
|
||||||
provider.block(MItems.PHANTOM_ATTRACTOR)
|
provider.block(MItems.PHANTOM_ATTRACTOR)
|
||||||
provider.block(MItems.HOLO_SIGN)
|
provider.block(MItems.HOLO_SIGN)
|
||||||
|
|
||||||
MRegistry.VENT.allItems.values.forEach(provider::block)
|
MRegistry.VENT.allItems.values.forEach(provider::block)
|
||||||
MRegistry.VENT_ALTERNATIVE.allItems.values.forEach(provider::block)
|
MRegistry.VENT_ALTERNATIVE.allItems.values.forEach(provider::block)
|
||||||
MRegistry.TRITANIUM_BLOCK.allItems.values.forEach(provider::block)
|
MRegistry.TRITANIUM_BLOCK.allItems.values.forEach(provider::block)
|
||||||
|
MRegistry.COMPUTER_TERMINAL.allItems.values.forEach(provider::block)
|
||||||
MRegistry.INDUSTRIAL_GLASS.allItems.values.forEach(provider::block)
|
MRegistry.INDUSTRIAL_GLASS.allItems.values.forEach(provider::block)
|
||||||
|
|
||||||
for (block in MRegistry.TRITANIUM_STRIPED_BLOCK.flatItems) {
|
for (block in MRegistry.TRITANIUM_STRIPED_BLOCK.flatItems) {
|
||||||
@ -159,31 +160,32 @@ fun addItemModels(provider: MatteryItemModelProvider) {
|
|||||||
provider.block(MItems.TRITANIUM_TRAPDOOR[null]!!, "tritanium_trapdoor_bottom")
|
provider.block(MItems.TRITANIUM_TRAPDOOR[null]!!, "tritanium_trapdoor_bottom")
|
||||||
|
|
||||||
|
|
||||||
for (color in DyeColor.values())
|
for (color in DyeColor.entries)
|
||||||
provider.block(MItems.TRITANIUM_TRAPDOOR[color]!!, "tritanium_trapdoor_${color.name.lowercase()}_bottom")
|
provider.block(MItems.TRITANIUM_TRAPDOOR[color]!!, "tritanium_trapdoor_${color.name.lowercase()}_bottom")
|
||||||
|
|
||||||
for (item in MRegistry.CARGO_CRATES.allItems.values) {
|
for (item in MRegistry.CARGO_CRATES.allItems.values)
|
||||||
provider.block(item, "${item.registryName!!.path}_closed")
|
provider.block(item, "${item.registryName!!.path}_closed")
|
||||||
}
|
|
||||||
|
|
||||||
provider.block(MItems.CHEMICAL_GENERATOR, "chemical_generator_working")
|
provider.block(MItems.CHEMICAL_GENERATOR, "chemical_generator_working")
|
||||||
provider.block(MItems.ENERGY_COUNTER, "energy_counter_down")
|
provider.block(MItems.ENERGY_COUNTER, "energy_counter_down")
|
||||||
provider.block(MItems.MATTER_BOTTLER, "matter_bottler_working")
|
provider.coloredWithBaseBlock(MItems.MATTER_BOTTLER, "matter_bottler", "_idle")
|
||||||
|
provider.coloredWithBaseBlock(MItems.MATTER_SCANNER, "matter_scanner", "_idle")
|
||||||
|
provider.coloredWithBaseBlock(MItems.MATTER_REPLICATOR, "matter_replicator", "_idle")
|
||||||
provider.block(MItems.MATTER_CABLE, "matter_cable_core")
|
provider.block(MItems.MATTER_CABLE, "matter_cable_core")
|
||||||
provider.block(MItems.MATTER_DECOMPOSER, "matter_decomposer_working")
|
provider.coloredWithBaseBlock(MItems.MATTER_DECOMPOSER, "matter_decomposer", "_idle")
|
||||||
provider.block(MItems.ENERGY_SERVO, "energy_servo")
|
provider.block(MItems.ENERGY_SERVO, "energy_servo")
|
||||||
provider.block(MItems.ESSENCE_STORAGE, "essence_storage")
|
provider.coloredWithBaseBlock(MItems.ESSENCE_STORAGE, "essence_storage")
|
||||||
provider.block(MItems.MATTER_RECONSTRUCTOR, "matter_reconstructor")
|
provider.coloredWithBaseBlock(MItems.MATTER_RECONSTRUCTOR, "matter_reconstructor")
|
||||||
|
|
||||||
provider.block(MItems.POWERED_BLAST_FURNACE, "powered_blast_furnace_working")
|
provider.coloredWithBaseBlock(MItems.POWERED_BLAST_FURNACE, "powered_blast_furnace", "_idle")
|
||||||
provider.block(MItems.POWERED_FURNACE, "powered_furnace_working")
|
provider.coloredWithBaseBlock(MItems.POWERED_FURNACE, "powered_furnace", "_idle")
|
||||||
provider.block(MItems.POWERED_SMOKER, "powered_smoker_working")
|
provider.coloredWithBaseBlock(MItems.POWERED_SMOKER, "powered_smoker", "_idle")
|
||||||
|
|
||||||
provider.block(MItems.PLATE_PRESS, "plate_press_idle")
|
provider.coloredWithBaseBlock(MItems.PLATE_PRESS, "plate_press", "_idle")
|
||||||
provider.block(MItems.TWIN_PLATE_PRESS, "twin_plate_press_idle")
|
provider.coloredWithBaseBlock(MItems.TWIN_PLATE_PRESS, "twin_plate_press", "_idle")
|
||||||
provider.block(MItems.STORAGE_POWER_SUPPLIER, "storage_power_supplier")
|
provider.block(MItems.STORAGE_POWER_SUPPLIER, "storage_power_supplier")
|
||||||
provider.block(MItems.MATTER_RECYCLER, "matter_recycler_working")
|
provider.coloredWithBaseBlock(MItems.MATTER_RECYCLER, "matter_recycler", "_idle")
|
||||||
provider.block(MItems.COBBLESTONE_GENERATOR, "cobblestone_generator")
|
provider.coloredWithBaseBlock(MItems.COBBLESTONE_GENERATOR, "cobblestone_generator")
|
||||||
|
|
||||||
provider.block(MItems.STORAGE_BUS)
|
provider.block(MItems.STORAGE_BUS)
|
||||||
provider.block(MItems.STORAGE_IMPORTER)
|
provider.block(MItems.STORAGE_IMPORTER)
|
||||||
|
@ -4,9 +4,9 @@ import net.minecraft.data.models.ItemModelGenerators
|
|||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.packs.PackType
|
import net.minecraft.server.packs.PackType
|
||||||
import net.minecraft.world.item.ArmorItem
|
import net.minecraft.world.item.ArmorItem
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.item.Item
|
import net.minecraft.world.item.Item
|
||||||
import net.minecraftforge.client.model.generators.ItemModelProvider
|
import net.minecraftforge.client.model.generators.ItemModelProvider
|
||||||
import net.minecraftforge.client.model.generators.ModelBuilder
|
|
||||||
import net.minecraftforge.data.event.GatherDataEvent
|
import net.minecraftforge.data.event.GatherDataEvent
|
||||||
import org.apache.logging.log4j.LogManager
|
import org.apache.logging.log4j.LogManager
|
||||||
import ru.dbotthepony.mc.otm.core.registryName
|
import ru.dbotthepony.mc.otm.core.registryName
|
||||||
@ -30,6 +30,23 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
|
|||||||
|
|
||||||
fun block(item: Item) = exec { withExistingParent(item.registryName!!.path, modLocation("block/${item.registryName!!.path}")) }
|
fun block(item: Item) = exec { withExistingParent(item.registryName!!.path, modLocation("block/${item.registryName!!.path}")) }
|
||||||
fun block(item: Item, path: String) = exec { withExistingParent(item.registryName!!.path, modLocation("block/$path")) }
|
fun block(item: Item, path: String) = exec { withExistingParent(item.registryName!!.path, modLocation("block/$path")) }
|
||||||
|
|
||||||
|
fun coloredWithBaseBlock(items: Map<DyeColor?, Item>, path: String) {
|
||||||
|
for (color in DyeColor.entries) {
|
||||||
|
block(items[color]!!, path + "_${color.name.lowercase()}")
|
||||||
|
}
|
||||||
|
|
||||||
|
block(items[null]!!, path)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun coloredWithBaseBlock(items: Map<DyeColor?, Item>, path: String, suffix: String) {
|
||||||
|
for (color in DyeColor.entries) {
|
||||||
|
block(items[color]!!, path + "_${color.name.lowercase()}$suffix")
|
||||||
|
}
|
||||||
|
|
||||||
|
block(items[null]!!, path + suffix)
|
||||||
|
}
|
||||||
|
|
||||||
fun blocks(vararg items: Item) = items.forEach(this::block)
|
fun blocks(vararg items: Item) = items.forEach(this::block)
|
||||||
fun blocks(items: Collection<Item>) = items.forEach(this::block)
|
fun blocks(items: Collection<Item>) = items.forEach(this::block)
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ private fun decoratives(provider: MatteryLanguageProvider) {
|
|||||||
add(MRegistry.VENT, "%s Vent")
|
add(MRegistry.VENT, "%s Vent")
|
||||||
add(MRegistry.VENT_ALTERNATIVE, "%s Alternative Vent")
|
add(MRegistry.VENT_ALTERNATIVE, "%s Alternative Vent")
|
||||||
|
|
||||||
|
add(MRegistry.COMPUTER_TERMINAL, "%s Computer Terminal")
|
||||||
add(MRegistry.TRITANIUM_BLOCK, "%s Tritanium Block")
|
add(MRegistry.TRITANIUM_BLOCK, "%s Tritanium Block")
|
||||||
add(MRegistry.TRITANIUM_STAIRS, "%s Tritanium Stairs")
|
add(MRegistry.TRITANIUM_STAIRS, "%s Tritanium Stairs")
|
||||||
add(MRegistry.TRITANIUM_SLAB, "%s Tritanium Slab")
|
add(MRegistry.TRITANIUM_SLAB, "%s Tritanium Slab")
|
||||||
@ -53,6 +54,7 @@ private fun decoratives(provider: MatteryLanguageProvider) {
|
|||||||
add(MEntityTypes.CARGO_CRATE_MINECARTS[null]!!, "Minecart with Cargo Crate")
|
add(MEntityTypes.CARGO_CRATE_MINECARTS[null]!!, "Minecart with Cargo Crate")
|
||||||
|
|
||||||
add(MRegistry.CARGO_CRATES.block, "Cargo Crate")
|
add(MRegistry.CARGO_CRATES.block, "Cargo Crate")
|
||||||
|
add(MRegistry.COMPUTER_TERMINAL.block, "Computer Terminal")
|
||||||
add(MRegistry.TRITANIUM_BLOCK.block, "Tritanium Block")
|
add(MRegistry.TRITANIUM_BLOCK.block, "Tritanium Block")
|
||||||
add(MRegistry.TRITANIUM_STAIRS.block, "Tritanium Stairs")
|
add(MRegistry.TRITANIUM_STAIRS.block, "Tritanium Stairs")
|
||||||
add(MRegistry.TRITANIUM_SLAB.block, "Tritanium Slab")
|
add(MRegistry.TRITANIUM_SLAB.block, "Tritanium Slab")
|
||||||
@ -117,6 +119,8 @@ private fun sounds(provider: MatteryLanguageProvider) {
|
|||||||
|
|
||||||
private fun misc(provider: MatteryLanguageProvider) {
|
private fun misc(provider: MatteryLanguageProvider) {
|
||||||
with(provider.english) {
|
with(provider.english) {
|
||||||
|
gui("shift_for_more_info", "<Hold SHIFT for more info>")
|
||||||
|
|
||||||
gui("help.slot_filters", "Hold CTRL to setup slot filters")
|
gui("help.slot_filters", "Hold CTRL to setup slot filters")
|
||||||
gui("help.slot_charging", "Hold ALT to switch slot charging")
|
gui("help.slot_charging", "Hold ALT to switch slot charging")
|
||||||
|
|
||||||
@ -151,6 +155,8 @@ private fun misc(provider: MatteryLanguageProvider) {
|
|||||||
gui("exopack.change_color2", "Remove color")
|
gui("exopack.change_color2", "Remove color")
|
||||||
gui("exopack.go_curios", "Open Curios inventory")
|
gui("exopack.go_curios", "Open Curios inventory")
|
||||||
|
|
||||||
|
gui("change_color", "Customize color")
|
||||||
|
|
||||||
gui("exopack.probe1", "This little device feels unnatural to touch, it is almost certainly resilient to any possible attempt to break it open.")
|
gui("exopack.probe1", "This little device feels unnatural to touch, it is almost certainly resilient to any possible attempt to break it open.")
|
||||||
gui("exopack.probe2", "There is fingerprint reader built into one of sides which gently glow when touched.")
|
gui("exopack.probe2", "There is fingerprint reader built into one of sides which gently glow when touched.")
|
||||||
gui("exopack.probe3", "It seems this box will unlock once you strongly press fingerprint reader, and you feel what's inside will affect you without any way back!")
|
gui("exopack.probe3", "It seems this box will unlock once you strongly press fingerprint reader, and you feel what's inside will affect you without any way back!")
|
||||||
@ -410,31 +416,34 @@ private fun death(provider: MatteryLanguageProvider) {
|
|||||||
|
|
||||||
private fun blocks(provider: MatteryLanguageProvider) {
|
private fun blocks(provider: MatteryLanguageProvider) {
|
||||||
with(provider.english) {
|
with(provider.english) {
|
||||||
add(MBlocks.ANDROID_STATION, "Android Station")
|
addBlock(MBlocks.ANDROID_STATION.values, "Android Station")
|
||||||
add(MBlocks.ANDROID_CHARGER, "Wireless Charger")
|
add(MBlocks.ANDROID_CHARGER, "Wireless Charger")
|
||||||
add(MBlocks.ANDROID_CHARGER, "desc", "Charges nearby androids and exopacks")
|
add(MBlocks.ANDROID_CHARGER, "desc", "Charges nearby androids and exopacks")
|
||||||
add(MBlocks.BATTERY_BANK, "Battery Bank")
|
addBlock(MBlocks.BATTERY_BANK.values, "Battery Bank")
|
||||||
add(MBlocks.MATTER_DECOMPOSER, "Matter Decomposer")
|
addBlock(MBlocks.MATTER_DECOMPOSER.values, "Matter Decomposer")
|
||||||
add(MBlocks.MATTER_CAPACITOR_BANK, "Matter Capacitor Bank")
|
addBlock(MBlocks.MATTER_CAPACITOR_BANK.values, "Matter Capacitor Bank")
|
||||||
add(MBlocks.MATTER_CABLE, "Matter Network Cable")
|
add(MBlocks.MATTER_CABLE, "Matter Network Cable")
|
||||||
add(MBlocks.PATTERN_STORAGE, "Pattern Storage")
|
add(MBlocks.PATTERN_STORAGE, "Pattern Storage")
|
||||||
add(MBlocks.MATTER_SCANNER, "Matter Scanner")
|
addBlock(MBlocks.MATTER_SCANNER.values, "Matter Scanner")
|
||||||
add(MBlocks.MATTER_PANEL, "Pattern Monitor")
|
add(MBlocks.MATTER_PANEL, "Pattern Monitor")
|
||||||
add(MBlocks.MATTER_REPLICATOR, "Matter Replicator")
|
addBlock(MBlocks.MATTER_REPLICATOR.values, "Matter Replicator")
|
||||||
add(MBlocks.MATTER_BOTTLER, "Matter Bottler")
|
addBlock(MBlocks.MATTER_BOTTLER.values, "Matter Bottler")
|
||||||
add(MBlocks.DRIVE_VIEWER, "Drive Viewer")
|
add(MBlocks.DRIVE_VIEWER, "Drive Viewer")
|
||||||
add(MBlocks.BLACK_HOLE, "Local Anomalous Spacetime Dilation Singular Point")
|
add(MBlocks.BLACK_HOLE, "Local Anomalous Spacetime Dilation Singular Point")
|
||||||
add(MBlocks.COBBLESTONE_GENERATOR, "Cobblestone Generator")
|
addBlock(MBlocks.COBBLESTONE_GENERATOR.values, "Cobblestone Generator")
|
||||||
add(MBlocks.INFINITE_WATER_SOURCE, "Infinite Water Source")
|
add(MBlocks.INFINITE_WATER_SOURCE, "Infinite Water Source")
|
||||||
add(MBlocks.ESSENCE_STORAGE, "Essence Storage")
|
addBlock(MBlocks.ESSENCE_STORAGE.values, "Essence Storage")
|
||||||
add(MBlocks.ESSENCE_STORAGE, "desc", "Allows to store and retrieve experience levels")
|
addBlock(MBlocks.ESSENCE_STORAGE.values, "desc", "Allows to store and retrieve experience levels")
|
||||||
add(MBlocks.MATTER_RECONSTRUCTOR, "Matter Reconstructor")
|
addBlock(MBlocks.MATTER_RECONSTRUCTOR.values, "Matter Reconstructor")
|
||||||
add(MBlocks.MATTER_RECONSTRUCTOR, "desc", "Repairs tools using matter")
|
addBlock(MBlocks.MATTER_RECONSTRUCTOR.values, "desc", "Repairs tools using matter")
|
||||||
add(MBlocks.DEV_CHEST, "Dev Chest")
|
add(MBlocks.DEV_CHEST, "Dev Chest")
|
||||||
add(MBlocks.DEV_CHEST, "desc", "Contains all items present in game")
|
add(MBlocks.DEV_CHEST, "desc", "Contains all items present in game")
|
||||||
add(MBlocks.PAINTER, "Painting Table")
|
add(MBlocks.PAINTER, "Painting Table")
|
||||||
add(MBlocks.MATTER_ENTANGLER, "Matter Entangler")
|
add(MBlocks.MATTER_ENTANGLER, "Matter Entangler")
|
||||||
|
|
||||||
|
add(MBlocks.LIQUID_XP, "Liquid XP")
|
||||||
|
add(MItems.LIQUID_XP_BUCKET, "Liquid XP Bucket")
|
||||||
|
|
||||||
add(MBlocks.FLUID_TANK, "Fluid Tank")
|
add(MBlocks.FLUID_TANK, "Fluid Tank")
|
||||||
add(MBlocks.FLUID_TANK, "named", "Fluid Tank (%s)")
|
add(MBlocks.FLUID_TANK, "named", "Fluid Tank (%s)")
|
||||||
|
|
||||||
@ -451,15 +460,15 @@ private fun blocks(provider: MatteryLanguageProvider) {
|
|||||||
|
|
||||||
add(MBlocks.CHEMICAL_GENERATOR, "Chemical Generator")
|
add(MBlocks.CHEMICAL_GENERATOR, "Chemical Generator")
|
||||||
add(MBlocks.DRIVE_RACK, "Condensation Drive Rack")
|
add(MBlocks.DRIVE_RACK, "Condensation Drive Rack")
|
||||||
add(MBlocks.ITEM_MONITOR, "Item Monitor")
|
addBlock(MBlocks.ITEM_MONITOR.values, "Item Monitor")
|
||||||
add(MBlocks.PLATE_PRESS, "Plate Press")
|
addBlock(MBlocks.PLATE_PRESS.values, "Plate Press")
|
||||||
add(MBlocks.TWIN_PLATE_PRESS, "Twin Plate Press")
|
addBlock(MBlocks.TWIN_PLATE_PRESS.values, "Twin Plate Press")
|
||||||
|
|
||||||
add(MBlocks.POWERED_FURNACE, "Electric Furnace")
|
addBlock(MBlocks.POWERED_FURNACE.values, "Electric Furnace")
|
||||||
add(MBlocks.POWERED_SMOKER, "Microwave Oven")
|
addBlock(MBlocks.POWERED_SMOKER.values, "Microwave Oven")
|
||||||
add(MBlocks.POWERED_BLAST_FURNACE, "Induction Furnace")
|
addBlock(MBlocks.POWERED_BLAST_FURNACE.values, "Induction Furnace")
|
||||||
|
|
||||||
add(MBlocks.MATTER_RECYCLER, "Matter Recycler")
|
addBlock(MBlocks.MATTER_RECYCLER.values, "Matter Recycler")
|
||||||
add(MBlocks.ENERGY_SERVO, "Energy Servo")
|
add(MBlocks.ENERGY_SERVO, "Energy Servo")
|
||||||
add(MBlocks.ENERGY_SERVO, "desc", "Charges, Discharges or Exchanges energy of items")
|
add(MBlocks.ENERGY_SERVO, "desc", "Charges, Discharges or Exchanges energy of items")
|
||||||
|
|
||||||
@ -609,19 +618,19 @@ private fun items(provider: MatteryLanguageProvider) {
|
|||||||
add(MItems.ELECTROMOTOR, "Electromotor")
|
add(MItems.ELECTROMOTOR, "Electromotor")
|
||||||
add(MItems.MIRROR_COMPOUND, "Mirror Compound")
|
add(MItems.MIRROR_COMPOUND, "Mirror Compound")
|
||||||
add(MItems.MIRROR, "Mirror")
|
add(MItems.MIRROR, "Mirror")
|
||||||
add(MItems.MIRROR, "description", "I can clearly see my own reflection in this mirror")
|
add(MItems.MIRROR, "desc", "I can clearly see my own reflection in this mirror")
|
||||||
add(MItems.REINFORCED_TRITANIUM_PLATE, "Reinforced Tritanium Plate")
|
add(MItems.REINFORCED_TRITANIUM_PLATE, "Reinforced Tritanium Plate")
|
||||||
add(MItems.REINFORCED_TRITANIUM_PLATE, "description", "An armor plate, reinforced to withstand great kinetic forces")
|
add(MItems.REINFORCED_TRITANIUM_PLATE, "desc", "An armor plate, reinforced to withstand great kinetic forces")
|
||||||
add(MItems.CARBON_MESH, "Carbon Mesh")
|
add(MItems.CARBON_MESH, "Carbon Mesh")
|
||||||
|
|
||||||
add(MItems.GRAVITATIONAL_DISRUPTOR, "Spacetime Equalizer")
|
add(MItems.GRAVITATIONAL_DISRUPTOR, "Spacetime Equalizer")
|
||||||
|
|
||||||
add(MItems.GRAVITATIONAL_DISRUPTOR, "description", "Once within close proximity of massive spacetime dilation anomaly, equalizes spacetime in it's radius")
|
add(MItems.GRAVITATIONAL_DISRUPTOR, "desc", "Once within close proximity of massive spacetime dilation anomaly, equalizes spacetime in it's radius")
|
||||||
add(MItems.GRAVITATIONAL_DISRUPTOR, "description2", "Allows collapse of singularities")
|
add(MItems.GRAVITATIONAL_DISRUPTOR, "desc2", "Allows collapse of singularities")
|
||||||
add(MItems.GRAVITATIONAL_DISRUPTOR, "description3", "Doesn't destroy any of mass singularity had acquired, which result in violent explosion of matter!")
|
add(MItems.GRAVITATIONAL_DISRUPTOR, "desc3", "Doesn't destroy any of mass singularity had acquired, which result in violent explosion of matter!")
|
||||||
add(MItems.GRAVITATIONAL_DISRUPTOR, "description4", "The explosion %s be contained by %s. Do not even attempt to contain it.")
|
add(MItems.GRAVITATIONAL_DISRUPTOR, "desc4", "The explosion %s be contained by %s. Do not even attempt to contain it.")
|
||||||
add(MItems.GRAVITATIONAL_DISRUPTOR, "description4_clarification", "can not")
|
add(MItems.GRAVITATIONAL_DISRUPTOR, "desc4_clarification", "can not")
|
||||||
add(MItems.GRAVITATIONAL_DISRUPTOR, "description4_clarification2", "anything")
|
add(MItems.GRAVITATIONAL_DISRUPTOR, "desc4_clarification2", "anything")
|
||||||
|
|
||||||
add(MItems.MATTER_DUST, "Matter Dust")
|
add(MItems.MATTER_DUST, "Matter Dust")
|
||||||
add(MItems.MATTER_DUST, "desc", "This item is product of failed decomposition or replication attempt")
|
add(MItems.MATTER_DUST, "desc", "This item is product of failed decomposition or replication attempt")
|
||||||
@ -791,9 +800,9 @@ private fun gui(provider: MatteryLanguageProvider) {
|
|||||||
|
|
||||||
gui("stored_amount", "Exact amount stored: %s")
|
gui("stored_amount", "Exact amount stored: %s")
|
||||||
|
|
||||||
gui("sides.item_config", "Item Configuration")
|
gui("sides.item_config", "Item")
|
||||||
gui("sides.energy_config", "Energy Configuration")
|
gui("sides.energy_config", "Energy")
|
||||||
gui("sides.fluid_config", "Fluid Configuration")
|
gui("sides.fluid_config", "Fluid")
|
||||||
|
|
||||||
gui("sides.pull_help", "Hold Shift to cycle pull mode")
|
gui("sides.pull_help", "Hold Shift to cycle pull mode")
|
||||||
gui("sides.push_help", "Hold Ctrl to cycle push mode")
|
gui("sides.push_help", "Hold Ctrl to cycle push mode")
|
||||||
|
@ -81,8 +81,11 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
|
|||||||
|
|
||||||
fun add(key: String, value: String) = slave.add(key, value)
|
fun add(key: String, value: String) = slave.add(key, value)
|
||||||
fun add(key: Block, value: String) = slave.add(key, value)
|
fun add(key: Block, value: String) = slave.add(key, value)
|
||||||
|
fun addBlock(key: Collection<Block>, value: String) = key.forEach { add(it, value) }
|
||||||
fun add(key: Block, suffix: String, value: String) = slave.add("${key.descriptionId}.${suffix}", value)
|
fun add(key: Block, suffix: String, value: String) = slave.add("${key.descriptionId}.${suffix}", value)
|
||||||
|
fun addBlock(key: Collection<Block>, suffix: String, value: String) = key.forEach { add(it, suffix, value) }
|
||||||
fun add(key: Item, value: String) = slave.add(key, value)
|
fun add(key: Item, value: String) = slave.add(key, value)
|
||||||
|
fun addItem(key: Collection<Item>, value: String) = key.forEach { add(it, value) }
|
||||||
fun add(key: Item, suffix: String, value: String) = slave.add("${key.descriptionId}.${suffix}", value)
|
fun add(key: Item, suffix: String, value: String) = slave.add("${key.descriptionId}.${suffix}", value)
|
||||||
fun add(key: ItemStack, value: String) = slave.add(key, value)
|
fun add(key: ItemStack, value: String) = slave.add(key, value)
|
||||||
fun add(key: Enchantment, value: String) = slave.add(key, value)
|
fun add(key: Enchantment, value: String) = slave.add(key, value)
|
||||||
@ -346,52 +349,6 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
|
|||||||
slave.add(redItem, toFormat.format(red))
|
slave.add(redItem, toFormat.format(red))
|
||||||
slave.add(blackItem, toFormat.format(black))
|
slave.add(blackItem, toFormat.format(black))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addBlocks(list: List<Block>, toFormat: String) {
|
|
||||||
add(
|
|
||||||
whiteBlock = list[0],
|
|
||||||
orangeBlock = list[1],
|
|
||||||
magentaBlock = list[2],
|
|
||||||
lightBlueBlock = list[3],
|
|
||||||
yellowBlock = list[4],
|
|
||||||
limeBlock = list[5],
|
|
||||||
pinkBlock = list[6],
|
|
||||||
grayBlock = list[7],
|
|
||||||
lightGrayBlock = list[8],
|
|
||||||
cyanBlock = list[9],
|
|
||||||
purpleBlock = list[10],
|
|
||||||
blueBlock = list[11],
|
|
||||||
brownBlock = list[12],
|
|
||||||
greenBlock = list[13],
|
|
||||||
redBlock = list[14],
|
|
||||||
blackBlock = list[15],
|
|
||||||
|
|
||||||
toFormat = toFormat
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun addItems(list: List<Item>, toFormat: String) {
|
|
||||||
add(
|
|
||||||
whiteItem = list[0],
|
|
||||||
orangeItem = list[1],
|
|
||||||
magentaItem = list[2],
|
|
||||||
lightBlueItem = list[3],
|
|
||||||
yellowItem = list[4],
|
|
||||||
limeItem = list[5],
|
|
||||||
pinkItem = list[6],
|
|
||||||
grayItem = list[7],
|
|
||||||
lightGrayItem = list[8],
|
|
||||||
cyanItem = list[9],
|
|
||||||
purpleItem = list[10],
|
|
||||||
blueItem = list[11],
|
|
||||||
brownItem = list[12],
|
|
||||||
greenItem = list[13],
|
|
||||||
redItem = list[14],
|
|
||||||
blackItem = list[15],
|
|
||||||
|
|
||||||
toFormat = toFormat
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val englishColors = Colors("en_us",
|
val englishColors = Colors("en_us",
|
||||||
|
@ -13,12 +13,13 @@ private const val FEELING_SAFE_NOW = "...ощущаете ли вы себя т
|
|||||||
|
|
||||||
private fun decoratives(provider: MatteryLanguageProvider) {
|
private fun decoratives(provider: MatteryLanguageProvider) {
|
||||||
with(provider.russianColors) {
|
with(provider.russianColors) {
|
||||||
add(MRegistry.VENT, "%s Вентиляция")
|
add(MRegistry.VENT, "%s вентиляция")
|
||||||
add(MRegistry.VENT_ALTERNATIVE, "%s Альтернативная Вентиляция")
|
add(MRegistry.VENT_ALTERNATIVE, "%s альтернативная вентиляция")
|
||||||
|
|
||||||
add(MRegistry.TRITANIUM_BLOCK, "%s тритановый блок")
|
add(MRegistry.TRITANIUM_BLOCK, "%s тритановый блок")
|
||||||
add(MRegistry.TRITANIUM_STAIRS, "%s Тритановые ступеньки")
|
add(MRegistry.COMPUTER_TERMINAL, "%s компьютерный терминал")
|
||||||
add(MRegistry.TRITANIUM_SLAB, "%s Тритановая плита")
|
add(MRegistry.TRITANIUM_STAIRS, "%s тритановые ступеньки")
|
||||||
|
add(MRegistry.TRITANIUM_SLAB, "%s тритановая плита")
|
||||||
add(MRegistry.TRITANIUM_WALL, "%s тритановая ограда")
|
add(MRegistry.TRITANIUM_WALL, "%s тритановая ограда")
|
||||||
add(MRegistry.FLOOR_TILES, "%s керамическая плитка")
|
add(MRegistry.FLOOR_TILES, "%s керамическая плитка")
|
||||||
add(MRegistry.FLOOR_TILES_STAIRS, "%s ступеньки из керамической плитки")
|
add(MRegistry.FLOOR_TILES_STAIRS, "%s ступеньки из керамической плитки")
|
||||||
@ -62,6 +63,7 @@ private fun decoratives(provider: MatteryLanguageProvider) {
|
|||||||
add(MEntityTypes.CARGO_CRATE_MINECARTS[null]!!, "Вагонетка с грузовым ящиком")
|
add(MEntityTypes.CARGO_CRATE_MINECARTS[null]!!, "Вагонетка с грузовым ящиком")
|
||||||
|
|
||||||
add(MRegistry.CARGO_CRATES.block, "Грузовой ящик")
|
add(MRegistry.CARGO_CRATES.block, "Грузовой ящик")
|
||||||
|
add(MRegistry.COMPUTER_TERMINAL.block, "Компьютерный терминал")
|
||||||
add(MRegistry.TRITANIUM_BLOCK.block, "Тритановый блок")
|
add(MRegistry.TRITANIUM_BLOCK.block, "Тритановый блок")
|
||||||
add(MRegistry.TRITANIUM_STAIRS.block, "Тритановые ступеньки")
|
add(MRegistry.TRITANIUM_STAIRS.block, "Тритановые ступеньки")
|
||||||
add(MRegistry.TRITANIUM_SLAB.block, "Тритановая плита")
|
add(MRegistry.TRITANIUM_SLAB.block, "Тритановая плита")
|
||||||
@ -125,6 +127,8 @@ private fun sounds(provider: MatteryLanguageProvider) {
|
|||||||
|
|
||||||
private fun misc(provider: MatteryLanguageProvider) {
|
private fun misc(provider: MatteryLanguageProvider) {
|
||||||
with(provider.russian) {
|
with(provider.russian) {
|
||||||
|
gui("shift_for_more_info", "<Удерживайте SHIFT для подробностей>")
|
||||||
|
|
||||||
gui("help.slot_filters", "Удерживайте CTRL для настройки фильтрации слотов")
|
gui("help.slot_filters", "Удерживайте CTRL для настройки фильтрации слотов")
|
||||||
gui("help.slot_charging", "Удерживайте ALT для переключения зарядки слотов")
|
gui("help.slot_charging", "Удерживайте ALT для переключения зарядки слотов")
|
||||||
|
|
||||||
@ -159,6 +163,8 @@ private fun misc(provider: MatteryLanguageProvider) {
|
|||||||
gui("exopack.change_color2", "Убрать окраску")
|
gui("exopack.change_color2", "Убрать окраску")
|
||||||
gui("exopack.go_curios", "Открыть инвентарь Curios")
|
gui("exopack.go_curios", "Открыть инвентарь Curios")
|
||||||
|
|
||||||
|
gui("change_color", "Изменить цвет")
|
||||||
|
|
||||||
gui("exopack.probe1", "Данное маленькое устройство необычно на ощупь, а так же неприступно для любых попыток вскрыть.")
|
gui("exopack.probe1", "Данное маленькое устройство необычно на ощупь, а так же неприступно для любых попыток вскрыть.")
|
||||||
gui("exopack.probe2", "На одной из сторон данного устройства находится сканер отпечатка, который тускло загорается при касании.")
|
gui("exopack.probe2", "На одной из сторон данного устройства находится сканер отпечатка, который тускло загорается при касании.")
|
||||||
gui("exopack.probe3", "Вероятно, устройство откроется если достаточно сильно нажать на сканер отпечатка, и вы чувствуете, что последствия будут необратимы!")
|
gui("exopack.probe3", "Вероятно, устройство откроется если достаточно сильно нажать на сканер отпечатка, и вы чувствуете, что последствия будут необратимы!")
|
||||||
@ -412,31 +418,34 @@ private fun death(provider: MatteryLanguageProvider) {
|
|||||||
|
|
||||||
private fun blocks(provider: MatteryLanguageProvider) {
|
private fun blocks(provider: MatteryLanguageProvider) {
|
||||||
with(provider.russian) {
|
with(provider.russian) {
|
||||||
add(MBlocks.ANDROID_STATION, "Станция андроидов")
|
addBlock(MBlocks.ANDROID_STATION.values, "Станция андроидов")
|
||||||
add(MBlocks.ANDROID_CHARGER, "Беспроводной зарядник")
|
add(MBlocks.ANDROID_CHARGER, "Беспроводной зарядник")
|
||||||
add(MBlocks.ANDROID_CHARGER, "desc", "Заряжает ближайших андроидов и экзопаки")
|
add(MBlocks.ANDROID_CHARGER, "desc", "Заряжает ближайших андроидов и экзопаки")
|
||||||
add(MBlocks.BATTERY_BANK, "Банк аккумуляторов")
|
addBlock(MBlocks.BATTERY_BANK.values, "Банк аккумуляторов")
|
||||||
add(MBlocks.MATTER_DECOMPOSER, "Декомпозитор материи")
|
addBlock(MBlocks.MATTER_DECOMPOSER.values, "Декомпозитор материи")
|
||||||
add(MBlocks.MATTER_CAPACITOR_BANK, "Банк накопителей материи")
|
addBlock(MBlocks.MATTER_CAPACITOR_BANK.values, "Банк накопителей материи")
|
||||||
add(MBlocks.MATTER_CABLE, "Кабель сети материи")
|
add(MBlocks.MATTER_CABLE, "Кабель сети материи")
|
||||||
add(MBlocks.PATTERN_STORAGE, "Хранилище шаблонов")
|
add(MBlocks.PATTERN_STORAGE, "Хранилище шаблонов")
|
||||||
add(MBlocks.MATTER_SCANNER, "Сканер материи")
|
addBlock(MBlocks.MATTER_SCANNER.values, "Сканер материи")
|
||||||
add(MBlocks.MATTER_PANEL, "Монитор шаблонов")
|
add(MBlocks.MATTER_PANEL, "Монитор шаблонов")
|
||||||
add(MBlocks.MATTER_REPLICATOR, "Репликатор материи")
|
addBlock(MBlocks.MATTER_REPLICATOR.values, "Репликатор материи")
|
||||||
add(MBlocks.MATTER_BOTTLER, "Бутилировщик материи")
|
addBlock(MBlocks.MATTER_BOTTLER.values, "Бутилировщик материи")
|
||||||
add(MBlocks.DRIVE_VIEWER, "Просмотрщик дисков конденсации")
|
add(MBlocks.DRIVE_VIEWER, "Просмотрщик дисков конденсации")
|
||||||
add(MBlocks.BLACK_HOLE, "Локализированная сингулярная точка аномального искажения пространства-времени")
|
add(MBlocks.BLACK_HOLE, "Локализированная сингулярная точка аномального искажения пространства-времени")
|
||||||
add(MBlocks.COBBLESTONE_GENERATOR, "Генератор булыжника")
|
addBlock(MBlocks.COBBLESTONE_GENERATOR.values, "Генератор булыжника")
|
||||||
add(MBlocks.INFINITE_WATER_SOURCE, "Неиссякаемый источник воды")
|
add(MBlocks.INFINITE_WATER_SOURCE, "Неиссякаемый источник воды")
|
||||||
add(MBlocks.ESSENCE_STORAGE, "Хранилище эссенции")
|
addBlock(MBlocks.ESSENCE_STORAGE.values, "Хранилище эссенции")
|
||||||
add(MBlocks.ESSENCE_STORAGE, "desc", "Позволяет хранить очки опыта")
|
addBlock(MBlocks.ESSENCE_STORAGE.values, "desc", "Позволяет хранить очки опыта")
|
||||||
add(MBlocks.MATTER_RECONSTRUCTOR, "Материальный реконструктор")
|
addBlock(MBlocks.MATTER_RECONSTRUCTOR.values, "Материальный реконструктор")
|
||||||
add(MBlocks.MATTER_RECONSTRUCTOR, "desc", "Чинит инструменты используя материю")
|
addBlock(MBlocks.MATTER_RECONSTRUCTOR.values, "desc", "Чинит инструменты используя материю")
|
||||||
add(MBlocks.DEV_CHEST, "Сундук разработчика")
|
add(MBlocks.DEV_CHEST, "Сундук разработчика")
|
||||||
add(MBlocks.DEV_CHEST, "desc", "Хранит все предметы, которые есть в игре")
|
add(MBlocks.DEV_CHEST, "desc", "Хранит все предметы, которые есть в игре")
|
||||||
add(MBlocks.PAINTER, "Стол маляра")
|
add(MBlocks.PAINTER, "Стол маляра")
|
||||||
add(MBlocks.MATTER_ENTANGLER, "Квантовый запутыватель материи")
|
add(MBlocks.MATTER_ENTANGLER, "Квантовый запутыватель материи")
|
||||||
|
|
||||||
|
add(MBlocks.LIQUID_XP, "Жидкий опыт")
|
||||||
|
add(MItems.LIQUID_XP_BUCKET, "Ведро жидкого опыта")
|
||||||
|
|
||||||
add(MBlocks.FLUID_TANK, "Жидкостный бак")
|
add(MBlocks.FLUID_TANK, "Жидкостный бак")
|
||||||
add(MBlocks.FLUID_TANK, "named", "Жидкостный бак (%s)")
|
add(MBlocks.FLUID_TANK, "named", "Жидкостный бак (%s)")
|
||||||
|
|
||||||
@ -453,15 +462,15 @@ private fun blocks(provider: MatteryLanguageProvider) {
|
|||||||
|
|
||||||
add(MBlocks.CHEMICAL_GENERATOR, "Химический генератор")
|
add(MBlocks.CHEMICAL_GENERATOR, "Химический генератор")
|
||||||
add(MBlocks.DRIVE_RACK, "Стеллаж дисков конденсации")
|
add(MBlocks.DRIVE_RACK, "Стеллаж дисков конденсации")
|
||||||
add(MBlocks.ITEM_MONITOR, "Монитор предметов")
|
addBlock(MBlocks.ITEM_MONITOR.values, "Монитор предметов")
|
||||||
add(MBlocks.PLATE_PRESS, "Пресс пластин")
|
addBlock(MBlocks.PLATE_PRESS.values, "Пресс пластин")
|
||||||
add(MBlocks.TWIN_PLATE_PRESS, "Двойной пресс пластин")
|
addBlock(MBlocks.TWIN_PLATE_PRESS.values, "Двойной пресс пластин")
|
||||||
|
|
||||||
add(MBlocks.POWERED_FURNACE, "Электрическая печь")
|
addBlock(MBlocks.POWERED_FURNACE.values, "Электрическая печь")
|
||||||
add(MBlocks.POWERED_BLAST_FURNACE, "Индукционная печь")
|
addBlock(MBlocks.POWERED_BLAST_FURNACE.values, "Индукционная печь")
|
||||||
add(MBlocks.POWERED_SMOKER, "Микроволновая печь")
|
addBlock(MBlocks.POWERED_SMOKER.values, "Микроволновая печь")
|
||||||
|
|
||||||
add(MBlocks.MATTER_RECYCLER, "Перерабатыватель материи")
|
addBlock(MBlocks.MATTER_RECYCLER.values, "Перерабатыватель материи")
|
||||||
add(MBlocks.ENERGY_SERVO, "Энергетическая помпа")
|
add(MBlocks.ENERGY_SERVO, "Энергетическая помпа")
|
||||||
add(MBlocks.ENERGY_SERVO, "Desc", "заряжает, разряжает и передаёт энергию между предметами")
|
add(MBlocks.ENERGY_SERVO, "Desc", "заряжает, разряжает и передаёт энергию между предметами")
|
||||||
|
|
||||||
@ -793,9 +802,9 @@ private fun gui(provider: MatteryLanguageProvider) {
|
|||||||
|
|
||||||
gui("stored_amount", "Точное количество в хранилище: %s шт.")
|
gui("stored_amount", "Точное количество в хранилище: %s шт.")
|
||||||
|
|
||||||
gui("sides.item_config", "Настройка предметов")
|
gui("sides.item_config", "Предметы")
|
||||||
gui("sides.energy_config", "Настройка энергии")
|
gui("sides.energy_config", "Энергия")
|
||||||
gui("sides.fluid_config", "Настройка жидкости")
|
gui("sides.fluid_config", "Жидкости")
|
||||||
|
|
||||||
gui("sides.pull_help", "Удерживайте Shift для настройки режима забора")
|
gui("sides.pull_help", "Удерживайте Shift для настройки режима забора")
|
||||||
gui("sides.push_help", "Удерживайте Ctrl для настройки режима выталкивания")
|
gui("sides.push_help", "Удерживайте Ctrl для настройки режима выталкивания")
|
||||||
|
@ -141,4 +141,14 @@ class LootTables(generator: DataGenerator) : LootTableProvider(generator.packOut
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun tile(blocks: Collection<Block>, vararg filterTags: String) {
|
||||||
|
for (block in blocks) {
|
||||||
|
singleLootPool(LootContextParamSets.BLOCK, block.lootTable) {
|
||||||
|
add(LootItem.lootTableItem(block).also {
|
||||||
|
it.apply(CopyTileNbtFunction(filterTags.stream()))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import ru.dbotthepony.mc.otm.registry.MRegistry
|
|||||||
fun addLootTables(lootTables: LootTables) {
|
fun addLootTables(lootTables: LootTables) {
|
||||||
lootTables.dropsSelf(MRegistry.DECORATIVE_CRATE.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
|
lootTables.dropsSelf(MRegistry.DECORATIVE_CRATE.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
|
||||||
|
|
||||||
|
lootTables.dropsSelf(MRegistry.COMPUTER_TERMINAL.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
|
||||||
lootTables.dropsSelf(MRegistry.CARGO_CRATES.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
|
lootTables.dropsSelf(MRegistry.CARGO_CRATES.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
|
||||||
lootTables.dropsSelf(MRegistry.INDUSTRIAL_GLASS.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
|
lootTables.dropsSelf(MRegistry.INDUSTRIAL_GLASS.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
|
||||||
lootTables.dropsSelf(MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
|
lootTables.dropsSelf(MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
|
||||||
@ -130,9 +131,9 @@ fun addLootTables(lootTables: LootTables) {
|
|||||||
lootPool { item(Items.BLACK_DYE) { setCount(64) } }
|
lootPool { item(Items.BLACK_DYE) { setCount(64) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
lootTables.tile(MBlocks.COBBLESTONE_GENERATOR)
|
lootTables.tile(MBlocks.COBBLESTONE_GENERATOR.values)
|
||||||
lootTables.tile(MBlocks.ESSENCE_STORAGE)
|
lootTables.tile(MBlocks.ESSENCE_STORAGE.values)
|
||||||
lootTables.tile(MBlocks.MATTER_RECONSTRUCTOR)
|
lootTables.tile(MBlocks.MATTER_RECONSTRUCTOR.values)
|
||||||
lootTables.tile(MBlocks.FLUID_TANK)
|
lootTables.tile(MBlocks.FLUID_TANK)
|
||||||
lootTables.tile(MBlocks.PAINTER)
|
lootTables.tile(MBlocks.PAINTER)
|
||||||
lootTables.tile(MBlocks.MATTER_ENTANGLER)
|
lootTables.tile(MBlocks.MATTER_ENTANGLER)
|
||||||
@ -142,9 +143,9 @@ fun addLootTables(lootTables: LootTables) {
|
|||||||
lootTables.tile(MBlocks.CHEMICAL_GENERATOR)
|
lootTables.tile(MBlocks.CHEMICAL_GENERATOR)
|
||||||
lootTables.tile(MBlocks.HOLO_SIGN, "isLocked")
|
lootTables.tile(MBlocks.HOLO_SIGN, "isLocked")
|
||||||
lootTables.tile(MBlocks.STORAGE_CABLE)
|
lootTables.tile(MBlocks.STORAGE_CABLE)
|
||||||
lootTables.tile(MBlocks.ANDROID_STATION)
|
lootTables.tile(MBlocks.ANDROID_STATION.values)
|
||||||
lootTables.tile(MBlocks.ANDROID_CHARGER)
|
lootTables.tile(MBlocks.ANDROID_CHARGER)
|
||||||
lootTables.tile(MBlocks.BATTERY_BANK)
|
lootTables.tile(MBlocks.BATTERY_BANK.values)
|
||||||
lootTables.tile(MBlocks.DRIVE_VIEWER)
|
lootTables.tile(MBlocks.DRIVE_VIEWER)
|
||||||
|
|
||||||
lootTables.tile(MBlocks.STORAGE_BUS)
|
lootTables.tile(MBlocks.STORAGE_BUS)
|
||||||
@ -153,19 +154,19 @@ fun addLootTables(lootTables: LootTables) {
|
|||||||
lootTables.tile(MBlocks.STORAGE_POWER_SUPPLIER)
|
lootTables.tile(MBlocks.STORAGE_POWER_SUPPLIER)
|
||||||
lootTables.tile(MBlocks.DRIVE_RACK)
|
lootTables.tile(MBlocks.DRIVE_RACK)
|
||||||
|
|
||||||
lootTables.tile(MBlocks.MATTER_DECOMPOSER)
|
lootTables.tile(MBlocks.MATTER_DECOMPOSER.values)
|
||||||
lootTables.tile(MBlocks.MATTER_REPLICATOR)
|
lootTables.tile(MBlocks.MATTER_REPLICATOR.values)
|
||||||
lootTables.tile(MBlocks.MATTER_RECYCLER)
|
lootTables.tile(MBlocks.MATTER_RECYCLER.values)
|
||||||
lootTables.tile(MBlocks.MATTER_SCANNER)
|
lootTables.tile(MBlocks.MATTER_SCANNER.values)
|
||||||
lootTables.tile(MBlocks.PLATE_PRESS)
|
lootTables.tile(MBlocks.PLATE_PRESS.values)
|
||||||
lootTables.tile(MBlocks.TWIN_PLATE_PRESS)
|
lootTables.tile(MBlocks.TWIN_PLATE_PRESS.values)
|
||||||
|
|
||||||
lootTables.tile(MBlocks.POWERED_FURNACE)
|
lootTables.tile(MBlocks.POWERED_FURNACE.values)
|
||||||
lootTables.tile(MBlocks.POWERED_SMOKER)
|
lootTables.tile(MBlocks.POWERED_SMOKER.values)
|
||||||
lootTables.tile(MBlocks.POWERED_BLAST_FURNACE)
|
lootTables.tile(MBlocks.POWERED_BLAST_FURNACE.values)
|
||||||
|
|
||||||
lootTables.tile(MBlocks.MATTER_PANEL)
|
lootTables.tile(MBlocks.MATTER_PANEL)
|
||||||
lootTables.tile(MBlocks.PATTERN_STORAGE)
|
lootTables.tile(MBlocks.PATTERN_STORAGE)
|
||||||
lootTables.tile(MBlocks.MATTER_CAPACITOR_BANK)
|
lootTables.tile(MBlocks.MATTER_CAPACITOR_BANK.values)
|
||||||
lootTables.tile(MBlocks.MATTER_BOTTLER)
|
lootTables.tile(MBlocks.MATTER_BOTTLER.values)
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
package ru.dbotthepony.mc.otm.datagen.models
|
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation
|
|
||||||
import ru.dbotthepony.mc.otm.registry.MBlocks
|
|
||||||
|
|
||||||
fun addBlockModels(provider: MatteryBlockModelProvider) {
|
|
||||||
with(provider) {
|
|
||||||
resourceCubeAll(MBlocks.TRITANIUM_ORE)
|
|
||||||
resourceCubeAll(MBlocks.TRITANIUM_RAW_BLOCK)
|
|
||||||
resourceCubeAll(MBlocks.DEEPSLATE_TRITANIUM_ORE)
|
|
||||||
resourceCubeAll(MBlocks.TRITANIUM_INGOT_BLOCK)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.datagen.models
|
package ru.dbotthepony.mc.otm.datagen.models
|
||||||
|
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraftforge.client.model.generators.BlockModelProvider
|
import net.minecraftforge.client.model.generators.BlockModelProvider
|
||||||
import net.minecraftforge.data.event.GatherDataEvent
|
import net.minecraftforge.data.event.GatherDataEvent
|
||||||
@ -96,4 +97,45 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun colored(modelName: String, suffix: String, textureKeys: Map<String, String>) {
|
||||||
|
for (color in DyeColor.entries) {
|
||||||
|
exec {
|
||||||
|
val model = withExistingParent(modelName + "_${color.name.lowercase()}$suffix", modLocation(modelName + suffix))
|
||||||
|
|
||||||
|
for ((key, value) in textureKeys) {
|
||||||
|
model.texture(key, modLocation("block/$value/${color.name.lowercase()}"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun colored(blocks: Map<DyeColor?, Block>, textureKeys: Collection<String>) {
|
||||||
|
val base = blocks[null]!!.registryName!!.path
|
||||||
|
colored(base, textureKeys.associateWith { base })
|
||||||
|
}
|
||||||
|
|
||||||
|
fun colored(modelName: String, textureKeys: Map<String, String>) {
|
||||||
|
return colored(modelName, "", textureKeys)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun colored(modelName: String, textureKeys: Collection<String>, textureName: String) {
|
||||||
|
return colored(modelName, "", textureKeys.associateWith { textureName })
|
||||||
|
}
|
||||||
|
|
||||||
|
fun colored(modelName: String, textureKeys: Collection<String>) {
|
||||||
|
return colored(modelName, "", textureKeys.associateWith { modelName })
|
||||||
|
}
|
||||||
|
|
||||||
|
fun coloredMachineCombined(modelName: String, textureName: String, textureKeys: Collection<String>) {
|
||||||
|
for (state in listOf("_idle", "_error", "_working")) {
|
||||||
|
colored(modelName, state, textureKeys.associateWith { textureName })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun coloredMachineCombined(modelName: String, textureKeys: Collection<String>) {
|
||||||
|
for (state in listOf("_idle", "_error", "_working")) {
|
||||||
|
colored(modelName, state, textureKeys.associateWith { modelName })
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
|||||||
.unlockedBy(MItems.HOLO_SIGN)
|
.unlockedBy(MItems.HOLO_SIGN)
|
||||||
.save(consumer, modLocation("holo_sign_reset"))
|
.save(consumer, modLocation("holo_sign_reset"))
|
||||||
|
|
||||||
MatteryRecipe(MBlocks.PLATE_PRESS, category = machinesCategory)
|
MatteryRecipe(MBlocks.PLATE_PRESS[null]!!, category = machinesCategory)
|
||||||
.row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS)
|
.row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS)
|
||||||
.row(MItemTags.TRITANIUM_INGOTS, Items.BLAST_FURNACE, MItemTags.TRITANIUM_INGOTS)
|
.row(MItemTags.TRITANIUM_INGOTS, Items.BLAST_FURNACE, MItemTags.TRITANIUM_INGOTS)
|
||||||
.row(MItemTags.PISTONS, MItemTags.TRITANIUM_INGOTS, MItemTags.PISTONS)
|
.row(MItemTags.PISTONS, MItemTags.TRITANIUM_INGOTS, MItemTags.PISTONS)
|
||||||
@ -62,21 +62,23 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
|||||||
.unlockedBy(MItems.ELECTRIC_PARTS)
|
.unlockedBy(MItems.ELECTRIC_PARTS)
|
||||||
.build(consumer)
|
.build(consumer)
|
||||||
|
|
||||||
MatteryRecipe(MBlocks.PLATE_PRESS, category = machinesCategory)
|
MatteryRecipe(MBlocks.PLATE_PRESS[null]!!, category = machinesCategory)
|
||||||
.rowB(MItemTags.PISTONS)
|
.rowB(MItemTags.PISTONS)
|
||||||
.rowB(MItems.MACHINE_FRAME)
|
.rowB(MItems.MACHINE_FRAME)
|
||||||
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
|
||||||
.unlockedBy(MItems.ELECTRIC_PARTS)
|
.unlockedBy(MItems.ELECTRIC_PARTS)
|
||||||
.build(consumer, "advanced")
|
.build(consumer, "advanced")
|
||||||
|
|
||||||
MatteryRecipe(MBlocks.TWIN_PLATE_PRESS, category = machinesCategory)
|
for ((color, press) in MBlocks.PLATE_PRESS) {
|
||||||
.setUpgradeSource(MItems.PLATE_PRESS)
|
MatteryRecipe(MBlocks.TWIN_PLATE_PRESS[color]!!, category = machinesCategory)
|
||||||
|
.setUpgradeSource(press)
|
||||||
.addUpgradeOps(UpgradeRecipe.Direct("BlockEntityTag"))
|
.addUpgradeOps(UpgradeRecipe.Direct("BlockEntityTag"))
|
||||||
.rowB(MItemTags.PISTONS)
|
.rowB(MItemTags.PISTONS)
|
||||||
.rowB(MItems.PLATE_PRESS)
|
.rowB(press)
|
||||||
.rowB(MItemTags.TRITANIUM_PLATES)
|
.rowB(MItemTags.TRITANIUM_PLATES)
|
||||||
.unlockedBy(MItems.PLATE_PRESS)
|
.unlockedBy(MBlocks.PLATE_PRESS.values)
|
||||||
.build(consumer)
|
.build(consumer, "twin_plate_press/${color?.name?.lowercase() ?: "default"}")
|
||||||
|
}
|
||||||
|
|
||||||
MatteryRecipe(MItems.PATTERN_DRIVE_NORMAL, category = machinesCategory)
|
MatteryRecipe(MItems.PATTERN_DRIVE_NORMAL, category = machinesCategory)
|
||||||
.rowAC(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
|
.rowAC(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
|
||||||
@ -86,7 +88,7 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
|||||||
.build(consumer)
|
.build(consumer)
|
||||||
|
|
||||||
// Машины
|
// Машины
|
||||||
MatteryRecipe(MItems.MATTER_RECYCLER, category = machinesCategory)
|
MatteryRecipe(MItems.MATTER_RECYCLER[null]!!, category = machinesCategory)
|
||||||
.row(MItems.MATTER_CAPACITOR_PARTS, Items.HOPPER, MItemTags.BASIC_CIRCUIT)
|
.row(MItems.MATTER_CAPACITOR_PARTS, Items.HOPPER, MItemTags.BASIC_CIRCUIT)
|
||||||
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
|
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
|
||||||
.row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE)
|
.row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE)
|
||||||
@ -94,14 +96,14 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
|||||||
.build(consumer)
|
.build(consumer)
|
||||||
|
|
||||||
// Блоки
|
// Блоки
|
||||||
MatteryRecipe(MItems.MATTER_CAPACITOR_BANK, category = machinesCategory)
|
MatteryRecipe(MItems.MATTER_CAPACITOR_BANK[null]!!, category = machinesCategory)
|
||||||
.row(Tags.Items.GLASS, MItemTags.IRON_PLATES, Tags.Items.GLASS)
|
.row(Tags.Items.GLASS, MItemTags.IRON_PLATES, Tags.Items.GLASS)
|
||||||
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
|
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
|
||||||
.row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE)
|
.row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE)
|
||||||
.unlockedBy(MItems.MATTER_CABLE)
|
.unlockedBy(MItems.MATTER_CABLE)
|
||||||
.build(consumer)
|
.build(consumer)
|
||||||
|
|
||||||
MatteryRecipe(MItems.BATTERY_BANK, category = machinesCategory)
|
MatteryRecipe(MItems.BATTERY_BANK[null]!!, category = machinesCategory)
|
||||||
.row(Tags.Items.GLASS, MItemTags.IRON_PLATES, Tags.Items.GLASS)
|
.row(Tags.Items.GLASS, MItemTags.IRON_PLATES, Tags.Items.GLASS)
|
||||||
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
|
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
|
||||||
.row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS)
|
.row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS)
|
||||||
@ -316,7 +318,7 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
|||||||
.build(consumer)
|
.build(consumer)
|
||||||
|
|
||||||
// станция андроида
|
// станция андроида
|
||||||
MatteryRecipe(MItems.ANDROID_STATION, category = machinesCategory)
|
MatteryRecipe(MItems.ANDROID_STATION[null]!!, category = machinesCategory)
|
||||||
.row(MItems.ELECTRIC_PARTS, MItemTags.ADVANCED_CIRCUIT, MItems.ELECTRIC_PARTS)
|
.row(MItems.ELECTRIC_PARTS, MItemTags.ADVANCED_CIRCUIT, MItems.ELECTRIC_PARTS)
|
||||||
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
|
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
|
||||||
.row(MItemTags.TRITANIUM_PLATES, MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES)
|
.row(MItemTags.TRITANIUM_PLATES, MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES)
|
||||||
@ -359,7 +361,7 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
|||||||
.build(consumer)
|
.build(consumer)
|
||||||
|
|
||||||
// генератор коблы
|
// генератор коблы
|
||||||
MatteryRecipe(MItems.COBBLESTONE_GENERATOR, category = machinesCategory)
|
MatteryRecipe(MItems.COBBLESTONE_GENERATOR[null]!!, category = machinesCategory)
|
||||||
.row(MItemTags.HARDENED_GLASS_COLORLESS, MItems.TRITANIUM_PICKAXE, MItemTags.HARDENED_GLASS_COLORLESS)
|
.row(MItemTags.HARDENED_GLASS_COLORLESS, MItems.TRITANIUM_PICKAXE, MItemTags.HARDENED_GLASS_COLORLESS)
|
||||||
.row(Items.LAVA_BUCKET, Items.HOPPER, Items.WATER_BUCKET)
|
.row(Items.LAVA_BUCKET, Items.HOPPER, Items.WATER_BUCKET)
|
||||||
.rowB(Tags.Items.CHESTS)
|
.rowB(Tags.Items.CHESTS)
|
||||||
@ -388,7 +390,7 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
|||||||
.unlockedBy(MItemTags.TRITANIUM_NUGGETS)
|
.unlockedBy(MItemTags.TRITANIUM_NUGGETS)
|
||||||
.save(consumer, modLocation("ingot_from_nuggets"))
|
.save(consumer, modLocation("ingot_from_nuggets"))
|
||||||
|
|
||||||
MatteryRecipe(MItems.ESSENCE_STORAGE, category = machinesCategory)
|
MatteryRecipe(MItems.ESSENCE_STORAGE[null]!!, category = machinesCategory)
|
||||||
.row(MItems.MATTER_CAPACITOR_PARTS, Items.ENDER_EYE, MItemTags.ADVANCED_CIRCUIT)
|
.row(MItems.MATTER_CAPACITOR_PARTS, Items.ENDER_EYE, MItemTags.ADVANCED_CIRCUIT)
|
||||||
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
|
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
|
||||||
.row(MItemTags.GOLD_WIRES, MItemTags.HARDENED_GLASS, MItemTags.HARDENED_GLASS)
|
.row(MItemTags.GOLD_WIRES, MItemTags.HARDENED_GLASS, MItemTags.HARDENED_GLASS)
|
||||||
@ -400,16 +402,18 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
|||||||
.rowB(Tags.Items.RODS_WOODEN)
|
.rowB(Tags.Items.RODS_WOODEN)
|
||||||
.build(consumer)
|
.build(consumer)
|
||||||
|
|
||||||
MatteryRecipe(MItems.MATTER_RECONSTRUCTOR, category = machinesCategory)
|
for ((dye, item) in MItems.MATTER_REPLICATOR) {
|
||||||
.setUpgradeSource(MItems.MATTER_REPLICATOR)
|
MatteryRecipe(MItems.MATTER_RECONSTRUCTOR[dye]!!, category = machinesCategory)
|
||||||
|
.setUpgradeSource(item)
|
||||||
.addUpgradeOps(
|
.addUpgradeOps(
|
||||||
UpgradeRecipe.Indirect("BlockEntityTag.${MatteryBlockEntity.ENERGY_KEY}", "BlockEntityTag.energy"),
|
UpgradeRecipe.Indirect("BlockEntityTag.${MatteryBlockEntity.ENERGY_KEY}", "BlockEntityTag.energy"),
|
||||||
UpgradeRecipe.Indirect("BlockEntityTag.${MatteryBlockEntity.MATTER_STORAGE_KEY}", "BlockEntityTag.matter"),
|
UpgradeRecipe.Indirect("BlockEntityTag.${MatteryBlockEntity.MATTER_STORAGE_KEY}", "BlockEntityTag.matter"),
|
||||||
)
|
)
|
||||||
.row(MItemTags.ADVANCED_CIRCUIT, Tags.Items.GEMS_EMERALD, MItemTags.ADVANCED_CIRCUIT)
|
.row(MItemTags.ADVANCED_CIRCUIT, Tags.Items.GEMS_EMERALD, MItemTags.ADVANCED_CIRCUIT)
|
||||||
.row(MItems.ELECTRIC_PARTS, MItems.MATTER_REPLICATOR, MItems.ELECTRIC_PARTS)
|
.row(MItems.ELECTRIC_PARTS, item, MItems.ELECTRIC_PARTS)
|
||||||
.row(MItems.ELECTROMAGNET, MItems.ELECTROMAGNET, MItems.ELECTROMAGNET)
|
.row(MItems.ELECTROMAGNET, MItems.ELECTROMAGNET, MItems.ELECTROMAGNET)
|
||||||
.build(consumer)
|
.build(consumer)
|
||||||
|
}
|
||||||
|
|
||||||
MatteryRecipe(MItems.FLUID_CAPSULE, category = RecipeCategory.TOOLS, count = 8)
|
MatteryRecipe(MItems.FLUID_CAPSULE, category = RecipeCategory.TOOLS, count = 8)
|
||||||
.row(MItemTags.TRITANIUM_NUGGETS, MItemTags.TRITANIUM_NUGGETS, MItemTags.TRITANIUM_NUGGETS)
|
.row(MItemTags.TRITANIUM_NUGGETS, MItemTags.TRITANIUM_NUGGETS, MItemTags.TRITANIUM_NUGGETS)
|
||||||
@ -436,18 +440,18 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
|
|||||||
.unlockedBy(Items.FLINT_AND_STEEL)
|
.unlockedBy(Items.FLINT_AND_STEEL)
|
||||||
.build(consumer)
|
.build(consumer)
|
||||||
|
|
||||||
MatteryRecipe(MItems.POWERED_FURNACE, category = machinesCategory)
|
MatteryRecipe(MItems.POWERED_FURNACE[null]!!, category = machinesCategory)
|
||||||
.row(Items.FURNACE, MItems.MACHINE_FRAME, Items.FURNACE)
|
.row(Items.FURNACE, MItems.MACHINE_FRAME, Items.FURNACE)
|
||||||
.unlockedBy(MItems.MACHINE_FRAME)
|
.unlockedBy(MItems.MACHINE_FRAME)
|
||||||
.build(consumer)
|
.build(consumer)
|
||||||
|
|
||||||
MatteryRecipe(MItems.POWERED_SMOKER, category = machinesCategory)
|
MatteryRecipe(MItems.POWERED_SMOKER[null]!!, category = machinesCategory)
|
||||||
.rowAC(Items.FURNACE, Items.FURNACE)
|
.rowAC(Items.FURNACE, Items.FURNACE)
|
||||||
.row(MItems.ELECTROMAGNET, MItems.MACHINE_FRAME, MItems.ELECTROMAGNET)
|
.row(MItems.ELECTROMAGNET, MItems.MACHINE_FRAME, MItems.ELECTROMAGNET)
|
||||||
.unlockedBy(MItems.MACHINE_FRAME)
|
.unlockedBy(MItems.MACHINE_FRAME)
|
||||||
.build(consumer)
|
.build(consumer)
|
||||||
|
|
||||||
MatteryRecipe(MItems.POWERED_BLAST_FURNACE, category = machinesCategory)
|
MatteryRecipe(MItems.POWERED_BLAST_FURNACE[null]!!, category = machinesCategory)
|
||||||
.row(MItems.ELECTROMAGNET, Items.FURNACE, MItems.ELECTROMAGNET)
|
.row(MItems.ELECTROMAGNET, Items.FURNACE, MItems.ELECTROMAGNET)
|
||||||
.row(MItems.ELECTROMAGNET, MItems.MACHINE_FRAME, MItems.ELECTROMAGNET)
|
.row(MItems.ELECTROMAGNET, MItems.MACHINE_FRAME, MItems.ELECTROMAGNET)
|
||||||
.row(MItems.ELECTROMAGNET, Items.FURNACE, MItems.ELECTROMAGNET)
|
.row(MItems.ELECTROMAGNET, Items.FURNACE, MItems.ELECTROMAGNET)
|
||||||
|
@ -233,7 +233,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
|||||||
DyeColor.BLACK to Items.BLACK_STAINED_GLASS,
|
DyeColor.BLACK to Items.BLACK_STAINED_GLASS,
|
||||||
)
|
)
|
||||||
|
|
||||||
for (color in DyeColor.values()) {
|
for (color in DyeColor.entries) {
|
||||||
val item = MRegistry.INDUSTRIAL_GLASS.items[color]!!
|
val item = MRegistry.INDUSTRIAL_GLASS.items[color]!!
|
||||||
val paneItem = MRegistry.INDUSTRIAL_GLASS_PANE.items[color]!!
|
val paneItem = MRegistry.INDUSTRIAL_GLASS_PANE.items[color]!!
|
||||||
val mappedVanilla = mappingUpgradeVanilla[color]!!
|
val mappedVanilla = mappingUpgradeVanilla[color]!!
|
||||||
|
@ -86,6 +86,11 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: Reci
|
|||||||
return unlockedBy("has_${location.namespace}_${location.path}", has(item))
|
return unlockedBy("has_${location.namespace}_${location.path}", has(item))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun unlockedBy(item: Collection<ItemLike>): MatteryRecipe {
|
||||||
|
item.forEach { unlockedBy(it) }
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
fun unlockedBy(item: TagKey<Item>): MatteryRecipe {
|
fun unlockedBy(item: TagKey<Item>): MatteryRecipe {
|
||||||
return unlockedBy("has_${item.location.namespace}_${item.location.path}", has(item))
|
return unlockedBy("has_${item.location.namespace}_${item.location.path}", has(item))
|
||||||
}
|
}
|
||||||
|
@ -271,6 +271,32 @@ fun addPainterRecipes(consumer: RecipeOutput) {
|
|||||||
generate(consumer, MItems.TRITANIUM_DOOR[null]!!, MItems.TRITANIUM_DOOR)
|
generate(consumer, MItems.TRITANIUM_DOOR[null]!!, MItems.TRITANIUM_DOOR)
|
||||||
generate(consumer, MItems.TRITANIUM_TRAPDOOR[null]!!, MItems.TRITANIUM_TRAPDOOR)
|
generate(consumer, MItems.TRITANIUM_TRAPDOOR[null]!!, MItems.TRITANIUM_TRAPDOOR)
|
||||||
|
|
||||||
|
val blocks = listOf(
|
||||||
|
MItems.COBBLESTONE_GENERATOR,
|
||||||
|
MItems.ESSENCE_STORAGE,
|
||||||
|
MItems.PLATE_PRESS,
|
||||||
|
MItems.TWIN_PLATE_PRESS,
|
||||||
|
MItems.ITEM_MONITOR,
|
||||||
|
MItems.MATTER_BOTTLER,
|
||||||
|
MItems.MATTER_RECONSTRUCTOR,
|
||||||
|
MItems.MATTER_REPLICATOR,
|
||||||
|
MItems.MATTER_SCANNER,
|
||||||
|
MItems.MATTER_CAPACITOR_BANK,
|
||||||
|
MItems.BATTERY_BANK,
|
||||||
|
MItems.MATTER_DECOMPOSER,
|
||||||
|
MItems.POWERED_SMOKER,
|
||||||
|
MItems.POWERED_FURNACE,
|
||||||
|
MItems.POWERED_BLAST_FURNACE,
|
||||||
|
MItems.MATTER_RECYCLER,
|
||||||
|
MItems.ANDROID_STATION,
|
||||||
|
)
|
||||||
|
|
||||||
|
for (list in blocks) {
|
||||||
|
generate(consumer, list[null]!!,list)
|
||||||
|
}
|
||||||
|
|
||||||
|
generate(consumer, MRegistry.COMPUTER_TERMINAL.item, MRegistry.COMPUTER_TERMINAL.items)
|
||||||
|
|
||||||
generate(consumer, MRegistry.VENT.item, MRegistry.VENT.items)
|
generate(consumer, MRegistry.VENT.item, MRegistry.VENT.items)
|
||||||
generate(consumer, MRegistry.VENT_ALTERNATIVE.item, MRegistry.VENT_ALTERNATIVE.items)
|
generate(consumer, MRegistry.VENT_ALTERNATIVE.item, MRegistry.VENT_ALTERNATIVE.items)
|
||||||
generate(consumer, MItems.CARGO_CRATE_MINECARTS[null]!!, MItems.CARGO_CRATE_MINECARTS)
|
generate(consumer, MItems.CARGO_CRATE_MINECARTS[null]!!, MItems.CARGO_CRATE_MINECARTS)
|
||||||
@ -288,5 +314,6 @@ fun addPainterRecipes(consumer: RecipeOutput) {
|
|||||||
for (color in DyeColor.entries) {
|
for (color in DyeColor.entries) {
|
||||||
consumer.accept(PainterArmorDyeRecipe(modLocation("painter/armor_dye_" + color.getName().lowercase()), mapOf(color to 1)).toFinished())
|
consumer.accept(PainterArmorDyeRecipe(modLocation("painter/armor_dye_" + color.getName().lowercase()), mapOf(color to 1)).toFinished())
|
||||||
}
|
}
|
||||||
|
|
||||||
consumer.accept(PainterArmorDyeRecipe(modLocation("painter/armor_clear_dye"), mapOf(null to 15)).toFinished())
|
consumer.accept(PainterArmorDyeRecipe(modLocation("painter/armor_clear_dye"), mapOf(null to 15)).toFinished())
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import net.minecraft.tags.ItemTags
|
|||||||
import net.minecraft.world.effect.MobEffects
|
import net.minecraft.world.effect.MobEffects
|
||||||
import net.minecraft.world.item.Items
|
import net.minecraft.world.item.Items
|
||||||
import net.minecraft.world.item.Tiers
|
import net.minecraft.world.item.Tiers
|
||||||
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraft.world.level.block.Blocks
|
import net.minecraft.world.level.block.Blocks
|
||||||
import net.minecraftforge.common.Tags
|
import net.minecraftforge.common.Tags
|
||||||
import ru.dbotthepony.mc.otm.registry.MBlockTags
|
import ru.dbotthepony.mc.otm.registry.MBlockTags
|
||||||
@ -178,26 +179,26 @@ fun addTags(tagsProvider: TagsProvider) {
|
|||||||
tagsProvider.requiresPickaxe(MBlocks.PAINTER, Tiers.STONE)
|
tagsProvider.requiresPickaxe(MBlocks.PAINTER, Tiers.STONE)
|
||||||
tagsProvider.requiresPickaxe(MBlocks.ENERGY_CABLES.values, Tiers.STONE)
|
tagsProvider.requiresPickaxe(MBlocks.ENERGY_CABLES.values, Tiers.STONE)
|
||||||
|
|
||||||
tagsProvider.requiresPickaxe(listOf(
|
tagsProvider.requiresPickaxe(listOf<Block>(
|
||||||
MBlocks.ANDROID_STATION,
|
*MBlocks.ANDROID_STATION.values.toTypedArray(),
|
||||||
MBlocks.BATTERY_BANK,
|
*MBlocks.BATTERY_BANK.values.toTypedArray(),
|
||||||
MBlocks.MATTER_DECOMPOSER,
|
*MBlocks.MATTER_DECOMPOSER.values.toTypedArray(),
|
||||||
MBlocks.MATTER_CAPACITOR_BANK,
|
*MBlocks.MATTER_CAPACITOR_BANK.values.toTypedArray(),
|
||||||
MBlocks.PATTERN_STORAGE,
|
MBlocks.PATTERN_STORAGE,
|
||||||
MBlocks.MATTER_SCANNER,
|
*MBlocks.MATTER_SCANNER.values.toTypedArray(),
|
||||||
MBlocks.MATTER_PANEL,
|
MBlocks.MATTER_PANEL,
|
||||||
MBlocks.MATTER_REPLICATOR,
|
*MBlocks.MATTER_REPLICATOR.values.toTypedArray(),
|
||||||
MBlocks.MATTER_BOTTLER,
|
*MBlocks.MATTER_BOTTLER.values.toTypedArray(),
|
||||||
MBlocks.ENERGY_COUNTER,
|
MBlocks.ENERGY_COUNTER,
|
||||||
MBlocks.CHEMICAL_GENERATOR,
|
MBlocks.CHEMICAL_GENERATOR,
|
||||||
MBlocks.PLATE_PRESS,
|
*MBlocks.PLATE_PRESS.values.toTypedArray(),
|
||||||
MBlocks.TWIN_PLATE_PRESS,
|
*MBlocks.TWIN_PLATE_PRESS.values.toTypedArray(),
|
||||||
MBlocks.MATTER_RECYCLER,
|
*MBlocks.MATTER_RECYCLER.values.toTypedArray(),
|
||||||
MBlocks.MATTER_ENTANGLER,
|
MBlocks.MATTER_ENTANGLER,
|
||||||
|
|
||||||
MBlocks.POWERED_FURNACE,
|
*MBlocks.POWERED_FURNACE.values.toTypedArray(),
|
||||||
MBlocks.POWERED_SMOKER,
|
*MBlocks.POWERED_SMOKER.values.toTypedArray(),
|
||||||
MBlocks.POWERED_BLAST_FURNACE,
|
*MBlocks.POWERED_BLAST_FURNACE.values.toTypedArray(),
|
||||||
|
|
||||||
MBlocks.STORAGE_BUS,
|
MBlocks.STORAGE_BUS,
|
||||||
MBlocks.STORAGE_IMPORTER,
|
MBlocks.STORAGE_IMPORTER,
|
||||||
@ -205,7 +206,7 @@ fun addTags(tagsProvider: TagsProvider) {
|
|||||||
|
|
||||||
MBlocks.DRIVE_VIEWER,
|
MBlocks.DRIVE_VIEWER,
|
||||||
MBlocks.DRIVE_RACK,
|
MBlocks.DRIVE_RACK,
|
||||||
MBlocks.ITEM_MONITOR,
|
*MBlocks.ITEM_MONITOR.values.toTypedArray(),
|
||||||
MBlocks.STORAGE_POWER_SUPPLIER,
|
MBlocks.STORAGE_POWER_SUPPLIER,
|
||||||
|
|
||||||
MBlocks.PHANTOM_ATTRACTOR,
|
MBlocks.PHANTOM_ATTRACTOR,
|
||||||
@ -218,9 +219,9 @@ fun addTags(tagsProvider: TagsProvider) {
|
|||||||
|
|
||||||
MBlocks.ENGINE,
|
MBlocks.ENGINE,
|
||||||
MBlocks.HOLO_SIGN,
|
MBlocks.HOLO_SIGN,
|
||||||
MBlocks.COBBLESTONE_GENERATOR,
|
*MBlocks.COBBLESTONE_GENERATOR.values.toTypedArray(),
|
||||||
MBlocks.ESSENCE_STORAGE,
|
*MBlocks.ESSENCE_STORAGE.values.toTypedArray(),
|
||||||
MBlocks.MATTER_RECONSTRUCTOR,
|
*MBlocks.MATTER_RECONSTRUCTOR.values.toTypedArray(),
|
||||||
MBlocks.FLUID_TANK,
|
MBlocks.FLUID_TANK,
|
||||||
MBlocks.ANDROID_CHARGER,
|
MBlocks.ANDROID_CHARGER,
|
||||||
), Tiers.IRON)
|
), Tiers.IRON)
|
||||||
@ -244,6 +245,7 @@ fun addTags(tagsProvider: TagsProvider) {
|
|||||||
tagsProvider.requiresPickaxe(MRegistry.VENT.allBlocks.values, Tiers.IRON)
|
tagsProvider.requiresPickaxe(MRegistry.VENT.allBlocks.values, Tiers.IRON)
|
||||||
tagsProvider.requiresPickaxe(MRegistry.VENT_ALTERNATIVE.allBlocks.values, Tiers.IRON)
|
tagsProvider.requiresPickaxe(MRegistry.VENT_ALTERNATIVE.allBlocks.values, Tiers.IRON)
|
||||||
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_BLOCK.allBlocks.values, Tiers.IRON)
|
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_BLOCK.allBlocks.values, Tiers.IRON)
|
||||||
|
tagsProvider.requiresPickaxe(MRegistry.COMPUTER_TERMINAL.allBlocks.values, Tiers.STONE)
|
||||||
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_SLAB.allBlocks.values, Tiers.IRON)
|
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_SLAB.allBlocks.values, Tiers.IRON)
|
||||||
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_WALL.allBlocks.values, Tiers.IRON)
|
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_WALL.allBlocks.values, Tiers.IRON)
|
||||||
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_PRESSURE_PLATE.allBlocks.values, Tiers.IRON)
|
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_PRESSURE_PLATE.allBlocks.values, Tiers.IRON)
|
||||||
|
@ -241,6 +241,7 @@ public final class OverdriveThatMatters {
|
|||||||
EVENT_BUS.addListener(EventPriority.LOWEST, ClientTickHandlerKt::onClientTick);
|
EVENT_BUS.addListener(EventPriority.LOWEST, ClientTickHandlerKt::onClientTick);
|
||||||
EVENT_BUS.addListener(EventPriority.HIGHEST, ClientTickHandlerKt::onClientConnected);
|
EVENT_BUS.addListener(EventPriority.HIGHEST, ClientTickHandlerKt::onClientConnected);
|
||||||
EVENT_BUS.addListener(EventPriority.HIGHEST, ClientTickHandlerKt::onClientDisconnected);
|
EVENT_BUS.addListener(EventPriority.HIGHEST, ClientTickHandlerKt::onClientDisconnected);
|
||||||
|
EVENT_BUS.addListener(EventPriority.NORMAL, ClientTickHandlerKt::onClientPostRender);
|
||||||
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::tooltipEvent);
|
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::tooltipEvent);
|
||||||
|
|
||||||
EVENT_BUS.addListener(EventPriority.NORMAL, QuantumBatteryItem.Companion::clientDisconnect);
|
EVENT_BUS.addListener(EventPriority.NORMAL, QuantumBatteryItem.Companion::clientDisconnect);
|
||||||
@ -254,5 +255,6 @@ public final class OverdriveThatMatters {
|
|||||||
EVENT_BUS.addListener(EventPriority.NORMAL, ExosuitModel::onPlayerRendered);
|
EVENT_BUS.addListener(EventPriority.NORMAL, ExosuitModel::onPlayerRendered);
|
||||||
|
|
||||||
event.enqueueWork(GlobalEventHandlerKt::recordClientThread);
|
event.enqueueWork(GlobalEventHandlerKt::recordClientThread);
|
||||||
|
event.enqueueWork(ClientTickHandlerKt::createCursors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -785,7 +785,7 @@ public class BlockShapes {
|
|||||||
new SimpleCuboid(0.3125d, 1.000625d, 0.125d, 0.6875d, 1.000625d, 0.1875d)
|
new SimpleCuboid(0.3125d, 1.000625d, 0.125d, 0.6875d, 1.000625d, 0.1875d)
|
||||||
);
|
);
|
||||||
|
|
||||||
public static final BlockShape POWERED_SMOKER_IDLE = new BlockShape(
|
public static final BlockShape POWERED_SMOKER = new BlockShape(
|
||||||
new SimpleCuboid(0.0625d, 0d, 0.5d, 0.9375d, 0.25d, 0.9375d),
|
new SimpleCuboid(0.0625d, 0d, 0.5d, 0.9375d, 0.25d, 0.9375d),
|
||||||
new SimpleCuboid(0d, 0d, 0d, 1d, 0.25d, 0.5d),
|
new SimpleCuboid(0d, 0d, 0d, 1d, 0.25d, 0.5d),
|
||||||
new SimpleCuboid(0d, 0.25d, 0d, 0.3125d, 1d, 1d),
|
new SimpleCuboid(0d, 0.25d, 0d, 0.3125d, 1d, 1d),
|
||||||
@ -797,4 +797,11 @@ public class BlockShapes {
|
|||||||
new SimpleCuboid(0.3125d, 0.3125d, 0.0625d, 0.9375d, 0.875d, 0.0625d),
|
new SimpleCuboid(0.3125d, 0.3125d, 0.0625d, 0.9375d, 0.875d, 0.0625d),
|
||||||
new SimpleCuboid(0.3125d, 0.6875d, 0.5d, 0.375d, 0.875d, 0.8125d)
|
new SimpleCuboid(0.3125d, 0.6875d, 0.5d, 0.375d, 0.875d, 0.8125d)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public static final BlockShape COMPUTER_TERMINAL = new BlockShape(
|
||||||
|
new SimpleCuboid(0.0625d, 0d, 0.0625d, 0.9375d, 0.125d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.125d, 0.3125d, 0.9375d, 0.3125d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.125d, 0.3125d, 0.25d, 0.875d, 0.9375d, 0.875d),
|
||||||
|
new SimpleCuboid(0.1875d, 0.5d, 0.875d, 0.8125d, 0.875d, 0.9375d)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ package ru.dbotthepony.mc.otm.block
|
|||||||
import com.google.common.collect.ImmutableMap
|
import com.google.common.collect.ImmutableMap
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap
|
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectFunction
|
import it.unimi.dsi.fastutil.objects.Object2ObjectFunction
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectIterators
|
||||||
|
import net.minecraft.ChatFormatting
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.core.Direction
|
import net.minecraft.core.Direction
|
||||||
import net.minecraft.core.particles.DustParticleOptions
|
import net.minecraft.core.particles.DustParticleOptions
|
||||||
@ -15,6 +17,8 @@ import net.minecraft.world.MenuProvider
|
|||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
import net.minecraft.world.entity.player.Player
|
import net.minecraft.world.entity.player.Player
|
||||||
import net.minecraft.world.item.ItemStack
|
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.Level
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraft.world.level.block.EntityBlock
|
import net.minecraft.world.level.block.EntityBlock
|
||||||
@ -28,13 +32,22 @@ import ru.dbotthepony.mc.otm.block.entity.IRedstoneControlled
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||||
|
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.TranslatableComponent
|
||||||
|
import ru.dbotthepony.mc.otm.core.addAll
|
||||||
|
import ru.dbotthepony.mc.otm.core.addDescriptionFunctions
|
||||||
|
import ru.dbotthepony.mc.otm.core.addDescriptionLines
|
||||||
import ru.dbotthepony.mc.otm.core.get
|
import ru.dbotthepony.mc.otm.core.get
|
||||||
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
|
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
|
||||||
import ru.dbotthepony.mc.otm.core.math.component1
|
import ru.dbotthepony.mc.otm.core.math.component1
|
||||||
import ru.dbotthepony.mc.otm.core.math.component2
|
import ru.dbotthepony.mc.otm.core.math.component2
|
||||||
import ru.dbotthepony.mc.otm.core.math.component3
|
import ru.dbotthepony.mc.otm.core.math.component3
|
||||||
|
import ru.dbotthepony.mc.otm.core.stream
|
||||||
import ru.dbotthepony.mc.otm.core.tagNotNull
|
import ru.dbotthepony.mc.otm.core.tagNotNull
|
||||||
import ru.dbotthepony.mc.otm.once
|
import ru.dbotthepony.mc.otm.once
|
||||||
|
import java.util.stream.Stream
|
||||||
|
|
||||||
fun Block.getShapeForEachState(properties: List<Property<*>>, fn: (BlockState) -> VoxelShape): Map<BlockState, VoxelShape> {
|
fun Block.getShapeForEachState(properties: List<Property<*>>, fn: (BlockState) -> VoxelShape): Map<BlockState, VoxelShape> {
|
||||||
val builder = ImmutableMap.Builder<BlockState, VoxelShape>()
|
val builder = ImmutableMap.Builder<BlockState, VoxelShape>()
|
||||||
@ -71,7 +84,7 @@ fun interface INeighbourChangeListener {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class MatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : Block(properties), INeighbourChangeListener {
|
open class MatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : Block(properties), INeighbourChangeListener, ITooltippable by ITooltippable.Impl() {
|
||||||
override fun setPlacedBy(
|
override fun setPlacedBy(
|
||||||
level: Level,
|
level: Level,
|
||||||
blockPos: BlockPos,
|
blockPos: BlockPos,
|
||||||
@ -238,9 +251,17 @@ abstract class MatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : Block
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun appendHoverText(itemStack: ItemStack, blockAccessor: BlockGetter?, components: MutableList<Component>, tooltipType: TooltipFlag) {
|
||||||
|
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
|
assembleDescription(itemStack, components)
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val DEFAULT_PROPERTIES: Properties = Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)
|
val DEFAULT_PROPERTIES: Properties = Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)
|
||||||
val DEFAULT_MACHINE_PROPERTIES: Properties = Properties.of().mapColor(MapColor.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)
|
val DEFAULT_MACHINE_PROPERTIES: Properties = Properties.of().mapColor(MapColor.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun <T : MatteryBlock> T.addSimpleDescription(suffix: String = "", formatting: ChatFormatting = ChatFormatting.GRAY): T {
|
||||||
|
return addDescriptionFunctions { ObjectIterators.singleton(TranslatableComponent("$descriptionId.desc$suffix").withStyle(formatting)) }
|
||||||
|
}
|
||||||
|
@ -10,7 +10,7 @@ import ru.dbotthepony.mc.otm.core.get
|
|||||||
import ru.dbotthepony.mc.otm.core.math.BlockRotation
|
import ru.dbotthepony.mc.otm.core.math.BlockRotation
|
||||||
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
|
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
|
||||||
|
|
||||||
abstract class RotatableMatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : MatteryBlock(properties) {
|
open class RotatableMatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : MatteryBlock(properties) {
|
||||||
init {
|
init {
|
||||||
@Suppress("LeakingThis")
|
@Suppress("LeakingThis")
|
||||||
registerDefaultState(getStateDefinition().any().setValue(rotationProperty, BlockRotation.SOUTH))
|
registerDefaultState(getStateDefinition().any().setValue(rotationProperty, BlockRotation.SOUTH))
|
||||||
@ -47,6 +47,7 @@ abstract class RotatableMatteryBlock(properties: Properties = DEFAULT_PROPERTIES
|
|||||||
}
|
}
|
||||||
|
|
||||||
BlockRotationFreedom.FULL -> TODO("Can't rotate with four rotation freedom yet")
|
BlockRotationFreedom.FULL -> TODO("Can't rotate with four rotation freedom yet")
|
||||||
|
BlockRotationFreedom.NONE -> defaultBlockState()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,10 +6,15 @@ import net.minecraft.world.level.block.entity.BlockEntity
|
|||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.material.PushReaction
|
import net.minecraft.world.level.material.PushReaction
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
|
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||||
import ru.dbotthepony.mc.otm.block.entity.decorative.DevChestBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.decorative.DevChestBlockEntity
|
||||||
|
|
||||||
class DevChestBlock : RotatableMatteryBlock(Properties.of().destroyTime(-1f).explosionResistance(360000f).pushReaction(PushReaction.BLOCK)), EntityBlock {
|
class DevChestBlock : RotatableMatteryBlock(Properties.of().destroyTime(-1f).explosionResistance(360000f).pushReaction(PushReaction.BLOCK)), EntityBlock {
|
||||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||||
return DevChestBlockEntity(p_153215_, p_153216_)
|
return DevChestBlockEntity(p_153215_, p_153216_)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
addSimpleDescription()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,13 @@ import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
|||||||
|
|
||||||
class EngineBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLOR_ORANGE).sound(SoundType.METAL).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops().pushReaction(PushReaction.NORMAL)) {
|
class EngineBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLOR_ORANGE).sound(SoundType.METAL).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops().pushReaction(PushReaction.NORMAL)) {
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
itemStack: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
blockAccessor: BlockGetter?,
|
||||||
p_49818_: MutableList<Component>,
|
components: MutableList<Component>,
|
||||||
p_49819_: TooltipFlag
|
tooltipType: TooltipFlag
|
||||||
) {
|
) {
|
||||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
p_49818_.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.DARK_GRAY))
|
components.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.DARK_GRAY))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun rotationFreedom(): BlockRotationFreedom {
|
override fun rotationFreedom(): BlockRotationFreedom {
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.block.decorative
|
||||||
|
|
||||||
|
import net.minecraft.ChatFormatting
|
||||||
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.network.chat.Component
|
||||||
|
import net.minecraft.world.entity.Entity
|
||||||
|
import net.minecraft.world.entity.monster.Zombie
|
||||||
|
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.block.DoorBlock
|
||||||
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
|
import net.minecraft.world.level.block.state.properties.BlockSetType
|
||||||
|
import net.minecraft.world.level.material.PushReaction
|
||||||
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
|
|
||||||
|
class TritaniumDoorBlock(val color: DyeColor?) : DoorBlock(
|
||||||
|
Properties.of()
|
||||||
|
.mapColor(color ?: DyeColor.LIGHT_BLUE)
|
||||||
|
.explosionResistance(80f)
|
||||||
|
.noOcclusion()
|
||||||
|
.destroyTime(3f)
|
||||||
|
.pushReaction(PushReaction.DESTROY)
|
||||||
|
.requiresCorrectToolForDrops(),
|
||||||
|
BlockSetType.IRON
|
||||||
|
) {
|
||||||
|
override fun appendHoverText(
|
||||||
|
p_49816_: ItemStack,
|
||||||
|
p_49817_: BlockGetter?,
|
||||||
|
p_49818_: MutableList<Component>,
|
||||||
|
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))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun canEntityDestroy(
|
||||||
|
state: BlockState,
|
||||||
|
level: BlockGetter,
|
||||||
|
pos: BlockPos,
|
||||||
|
entity: Entity
|
||||||
|
): Boolean {
|
||||||
|
return entity !is Zombie && super.canEntityDestroy(state, level, pos, entity)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.block.decorative
|
||||||
|
|
||||||
|
import net.minecraft.ChatFormatting
|
||||||
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.network.chat.Component
|
||||||
|
import net.minecraft.world.entity.Entity
|
||||||
|
import net.minecraft.world.entity.EntityType
|
||||||
|
import net.minecraft.world.entity.monster.Zombie
|
||||||
|
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.block.TrapDoorBlock
|
||||||
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
|
import net.minecraft.world.level.block.state.properties.BlockSetType
|
||||||
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
|
|
||||||
|
class TritaniumTrapdoorBlock(val color: DyeColor?) : TrapDoorBlock(
|
||||||
|
Properties.of()
|
||||||
|
.mapColor(color ?: DyeColor.LIGHT_BLUE)
|
||||||
|
.explosionResistance(80f)
|
||||||
|
.noOcclusion().destroyTime(3f)
|
||||||
|
.requiresCorrectToolForDrops()
|
||||||
|
.isValidSpawn { _: BlockState, _: BlockGetter, _: BlockPos, _: EntityType<*>? -> false },
|
||||||
|
BlockSetType.IRON
|
||||||
|
) {
|
||||||
|
override fun appendHoverText(
|
||||||
|
p_49816_: ItemStack,
|
||||||
|
p_49817_: BlockGetter?,
|
||||||
|
p_49818_: MutableList<Component>,
|
||||||
|
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))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun canEntityDestroy(
|
||||||
|
state: BlockState,
|
||||||
|
level: BlockGetter,
|
||||||
|
pos: BlockPos,
|
||||||
|
entity: Entity
|
||||||
|
): Boolean {
|
||||||
|
return entity !is Zombie && super.canEntityDestroy(state, level, pos, entity)
|
||||||
|
}
|
||||||
|
}
|
@ -25,12 +25,22 @@ class HoloSignBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryB
|
|||||||
access.write(value)
|
access.write(value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var textRed by synchronizer.float(1f).property
|
||||||
|
var textGreen by synchronizer.float(1f).property
|
||||||
|
var textBlue by synchronizer.float(85f / 255f).property
|
||||||
|
var textAlpha by synchronizer.float(1f).property
|
||||||
|
|
||||||
var isLocked = false
|
var isLocked = false
|
||||||
|
|
||||||
init {
|
init {
|
||||||
savetables.string(::signText)
|
savetables.string(::signText)
|
||||||
savetablesLevel.bool(::isLocked)
|
savetablesLevel.bool(::isLocked)
|
||||||
savetables.stateful(::redstoneControl)
|
savetables.stateful(::redstoneControl)
|
||||||
|
|
||||||
|
savetables.float(::textRed)
|
||||||
|
savetables.float(::textGreen)
|
||||||
|
savetables.float(::textBlue)
|
||||||
|
savetables.float(::textAlpha)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createMenu(p_39954_: Int, p_39955_: Inventory, p_39956_: Player): AbstractContainerMenu {
|
override fun createMenu(p_39954_: Int, p_39955_: Inventory, p_39956_: Player): AbstractContainerMenu {
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity.tech
|
package ru.dbotthepony.mc.otm.block.entity.tech
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.core.Direction
|
|
||||||
import net.minecraft.server.level.ServerLevel
|
import net.minecraft.server.level.ServerLevel
|
||||||
import net.minecraft.server.level.ServerPlayer
|
|
||||||
import net.minecraft.world.entity.ExperienceOrb
|
|
||||||
import net.minecraft.world.entity.player.Inventory
|
import net.minecraft.world.entity.player.Inventory
|
||||||
import net.minecraft.world.entity.player.Player
|
import net.minecraft.world.entity.player.Player
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu
|
import net.minecraft.world.inventory.AbstractContainerMenu
|
||||||
import net.minecraft.world.item.crafting.AbstractCookingRecipe
|
import net.minecraft.world.item.crafting.AbstractCookingRecipe
|
||||||
|
import net.minecraft.world.item.crafting.BlastingRecipe
|
||||||
import net.minecraft.world.item.crafting.RecipeType
|
import net.minecraft.world.item.crafting.RecipeType
|
||||||
|
import net.minecraft.world.item.crafting.SmeltingRecipe
|
||||||
|
import net.minecraft.world.item.crafting.SmokingRecipe
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraftforge.common.capabilities.ForgeCapabilities
|
import net.minecraftforge.common.capabilities.ForgeCapabilities
|
||||||
@ -35,18 +35,20 @@ import ru.dbotthepony.mc.otm.core.immutableList
|
|||||||
import ru.dbotthepony.mc.otm.core.value
|
import ru.dbotthepony.mc.otm.core.value
|
||||||
import ru.dbotthepony.mc.otm.menu.tech.PoweredFurnaceMenu
|
import ru.dbotthepony.mc.otm.menu.tech.PoweredFurnaceMenu
|
||||||
import ru.dbotthepony.mc.otm.recipe.MatteryCookingRecipe
|
import ru.dbotthepony.mc.otm.recipe.MatteryCookingRecipe
|
||||||
|
import ru.dbotthepony.mc.otm.recipe.MicrowaveRecipe
|
||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
|
import ru.dbotthepony.mc.otm.registry.MRecipes
|
||||||
|
|
||||||
class PoweredFurnaceBlockEntity(
|
sealed class AbstractPoweredFurnaceBlockEntity<P : AbstractCookingRecipe, S : MatteryCookingRecipe>(
|
||||||
type: BlockEntityType<PoweredFurnaceBlockEntity>,
|
type: BlockEntityType<*>,
|
||||||
blockPos: BlockPos,
|
blockPos: BlockPos,
|
||||||
blockState: BlockState,
|
blockState: BlockState,
|
||||||
val recipeType: RecipeType<out AbstractCookingRecipe>,
|
val recipeType: RecipeType<P>,
|
||||||
val secondaryRecipeType: (() -> RecipeType<out MatteryCookingRecipe>)?,
|
val secondaryRecipeType: RecipeType<S>?,
|
||||||
val config: WorkerBalanceValues
|
val config: WorkerBalanceValues
|
||||||
) : MatteryWorkerBlockEntity<ItemJob>(type, blockPos, blockState, ItemJob.CODEC, 2) {
|
) : MatteryWorkerBlockEntity<ItemJob>(type, blockPos, blockState, ItemJob.CODEC, 2) {
|
||||||
override val upgrades = UpgradeContainer(this::markDirtyFast, 2, UpgradeType.BASIC_PROCESSING)
|
final override val upgrades = UpgradeContainer(this::markDirtyFast, 2, UpgradeType.BASIC_PROCESSING)
|
||||||
override val energy = ProfiledEnergyStorage(WorkerEnergyStorage(this::energyLevelUpdated, upgrades.transform(config)))
|
final override val energy = ProfiledEnergyStorage(WorkerEnergyStorage(this::energyLevelUpdated, upgrades.transform(config)))
|
||||||
|
|
||||||
val inputs = immutableList(2) { MatteryContainer(this::itemContainerUpdated, 1) }
|
val inputs = immutableList(2) { MatteryContainer(this::itemContainerUpdated, 1) }
|
||||||
val outputs = immutableList(2) { MatteryContainer(this::itemContainerUpdated, 1) }
|
val outputs = immutableList(2) { MatteryContainer(this::itemContainerUpdated, 1) }
|
||||||
@ -86,15 +88,6 @@ class PoweredFurnaceBlockEntity(
|
|||||||
super.tick()
|
super.tick()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu? {
|
|
||||||
return when (type) {
|
|
||||||
MBlockEntities.POWERED_FURNACE -> PoweredFurnaceMenu.furnace(containerID, inventory, this)
|
|
||||||
MBlockEntities.POWERED_BLAST_FURNACE -> PoweredFurnaceMenu.blasting(containerID, inventory, this)
|
|
||||||
MBlockEntities.POWERED_SMOKER -> PoweredFurnaceMenu.smoking(containerID, inventory, this)
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onJobFinish(status: JobStatus<ItemJob>, id: Int) {
|
override fun onJobFinish(status: JobStatus<ItemJob>, id: Int) {
|
||||||
if (outputs[id].fullyAddItem(status.job.itemStack)) {
|
if (outputs[id].fullyAddItem(status.job.itemStack)) {
|
||||||
experience.storeExperience(status.experience, this)
|
experience.storeExperience(status.experience, this)
|
||||||
@ -114,7 +107,7 @@ class PoweredFurnaceBlockEntity(
|
|||||||
|
|
||||||
if (secondaryRecipeType != null) {
|
if (secondaryRecipeType != null) {
|
||||||
val recipe = level.recipeManager
|
val recipe = level.recipeManager
|
||||||
.byType(secondaryRecipeType.invoke() as RecipeType<MatteryCookingRecipe>)
|
.byType(secondaryRecipeType)
|
||||||
.values
|
.values
|
||||||
.iterator()
|
.iterator()
|
||||||
.filter { it.value.matches(inputs[id], 0) }
|
.filter { it.value.matches(inputs[id], 0) }
|
||||||
@ -135,7 +128,7 @@ class PoweredFurnaceBlockEntity(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return level.recipeManager.getRecipeFor(recipeType as RecipeType<AbstractCookingRecipe>, inputs[id], level).map {
|
return level.recipeManager.getRecipeFor(recipeType, inputs[id], level).map {
|
||||||
val output = it.value.assemble(inputs[id], level.registryAccess())
|
val output = it.value.assemble(inputs[id], level.registryAccess())
|
||||||
val toProcess = inputs[id][0].count.coerceAtMost(upgrades.processingItems + 1)
|
val toProcess = inputs[id][0].count.coerceAtMost(upgrades.processingItems + 1)
|
||||||
inputs[id][0].shrink(toProcess)
|
inputs[id][0].shrink(toProcess)
|
||||||
@ -146,3 +139,21 @@ class PoweredFurnaceBlockEntity(
|
|||||||
}.orElse(JobContainer.noItem())
|
}.orElse(JobContainer.noItem())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PoweredFurnaceBlockEntity(blockPos: BlockPos, blockState: BlockState) : AbstractPoweredFurnaceBlockEntity<SmeltingRecipe, MatteryCookingRecipe>(MBlockEntities.POWERED_FURNACE, blockPos, blockState, RecipeType.SMELTING, null, MachinesConfig.POWERED_FURNACE) {
|
||||||
|
override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu {
|
||||||
|
return PoweredFurnaceMenu.furnace(containerID, inventory, this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PoweredBlastFurnaceBlockEntity(blockPos: BlockPos, blockState: BlockState) : AbstractPoweredFurnaceBlockEntity<BlastingRecipe, MatteryCookingRecipe>(MBlockEntities.POWERED_BLAST_FURNACE, blockPos, blockState, RecipeType.BLASTING, null, MachinesConfig.POWERED_FURNACE) {
|
||||||
|
override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu {
|
||||||
|
return PoweredFurnaceMenu.blasting(containerID, inventory, this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PoweredSmokerBlockEntity(blockPos: BlockPos, blockState: BlockState) : AbstractPoweredFurnaceBlockEntity<SmokingRecipe, MicrowaveRecipe>(MBlockEntities.POWERED_SMOKER, blockPos, blockState, RecipeType.SMOKING, MRecipes.MICROWAVE, MachinesConfig.POWERED_FURNACE) {
|
||||||
|
override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu {
|
||||||
|
return PoweredFurnaceMenu.smoking(containerID, inventory, this)
|
||||||
|
}
|
||||||
|
}
|
@ -61,6 +61,8 @@ class EssenceStorageBlockEntity(blockPos: BlockPos, blockState: BlockState) : Ma
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val fluidConfig = ConfigurableFluidHandler(this)
|
||||||
|
|
||||||
override fun getTanks(): Int {
|
override fun getTanks(): Int {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
@ -69,10 +71,10 @@ class EssenceStorageBlockEntity(blockPos: BlockPos, blockState: BlockState) : Ma
|
|||||||
if (tank != 0)
|
if (tank != 0)
|
||||||
return FluidStack.EMPTY
|
return FluidStack.EMPTY
|
||||||
|
|
||||||
if (experienceStored >= 2_000_000_000L)
|
if ((experienceStored * XP_TO_LIQUID_RATIO) >= 2_000_000_000L)
|
||||||
return FluidStack(MFluids.LIQUID_XP, 2_000_000_000)
|
return FluidStack(MFluids.LIQUID_XP, 2_000_000_000)
|
||||||
|
|
||||||
return FluidStack(MFluids.LIQUID_XP, experienceStored.toInt())
|
return FluidStack(MFluids.LIQUID_XP, (experienceStored * XP_TO_LIQUID_RATIO).toInt())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getTankCapacity(tank: Int): Int {
|
override fun getTankCapacity(tank: Int): Int {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.matter
|
package ru.dbotthepony.mc.otm.block.matter
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext
|
import net.minecraft.world.item.context.BlockPlaceContext
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
@ -22,7 +23,7 @@ import ru.dbotthepony.mc.otm.core.get
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class MatterBottlerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
class MatterBottlerBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return MatterBottlerBlockEntity(blockPos, blockState)
|
return MatterBottlerBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.block.matter
|
|||||||
|
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.core.Direction
|
import net.minecraft.core.Direction
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext
|
import net.minecraft.world.item.context.BlockPlaceContext
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
@ -18,7 +19,7 @@ import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
|||||||
import ru.dbotthepony.mc.otm.core.get
|
import ru.dbotthepony.mc.otm.core.get
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class MatterCapacitorBankBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
class MatterCapacitorBankBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return MatterCapacitorBankBlockEntity(blockPos, blockState)
|
return MatterCapacitorBankBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import net.minecraft.MethodsReturnNonnullByDefault
|
|||||||
import javax.annotation.ParametersAreNonnullByDefault
|
import javax.annotation.ParametersAreNonnullByDefault
|
||||||
import net.minecraft.world.level.block.EntityBlock
|
import net.minecraft.world.level.block.EntityBlock
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity
|
import net.minecraft.world.level.block.entity.BlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterDecomposerBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.matter.MatterDecomposerBlockEntity
|
||||||
@ -22,7 +23,7 @@ import ru.dbotthepony.mc.otm.core.get
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class MatterDecomposerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
class MatterDecomposerBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return MatterDecomposerBlockEntity(blockPos, blockState)
|
return MatterDecomposerBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.matter
|
package ru.dbotthepony.mc.otm.block.matter
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
import net.minecraft.world.level.block.EntityBlock
|
import net.minecraft.world.level.block.EntityBlock
|
||||||
@ -11,12 +12,13 @@ import net.minecraft.world.level.block.state.BlockState
|
|||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
|
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterReconstructorBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.matter.MatterReconstructorBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||||
import ru.dbotthepony.mc.otm.core.get
|
import ru.dbotthepony.mc.otm.core.get
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class MatterReconstructorBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
class MatterReconstructorBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||||
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
|
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
|
||||||
return MatterReconstructorBlockEntity(pPos, pState)
|
return MatterReconstructorBlockEntity(pPos, pState)
|
||||||
}
|
}
|
||||||
@ -28,6 +30,10 @@ class MatterReconstructorBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIE
|
|||||||
return BlockEntityTicker { _, _, _, pBlockEntity -> if (pBlockEntity is MatterReconstructorBlockEntity) pBlockEntity.tick() }
|
return BlockEntityTicker { _, _, _, pBlockEntity -> if (pBlockEntity is MatterReconstructorBlockEntity) pBlockEntity.tick() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
addSimpleDescription()
|
||||||
|
}
|
||||||
|
|
||||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.MATTER_RECONSTRUCTOR.rotateFromNorth(it[rotationProperty]).computeShape() }
|
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.MATTER_RECONSTRUCTOR.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||||
|
|
||||||
@Suppress("override_deprecation")
|
@Suppress("override_deprecation")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.matter
|
package ru.dbotthepony.mc.otm.block.matter
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
@ -20,7 +21,7 @@ import ru.dbotthepony.mc.otm.core.get
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class MatterRecyclerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
class MatterRecyclerBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||||
return MatterRecyclerBlockEntity(p_153215_, p_153216_)
|
return MatterRecyclerBlockEntity(p_153215_, p_153216_)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.matter
|
package ru.dbotthepony.mc.otm.block.matter
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
@ -20,7 +21,7 @@ import ru.dbotthepony.mc.otm.core.get
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class MatterReplicatorBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
class MatterReplicatorBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return MatterReplicatorBlockEntity(blockPos, blockState)
|
return MatterReplicatorBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.matter
|
package ru.dbotthepony.mc.otm.block.matter
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
@ -20,7 +21,7 @@ import ru.dbotthepony.mc.otm.core.get
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class MatterScannerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
class MatterScannerBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return MatterScannerBlockEntity(blockPos, blockState)
|
return MatterScannerBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
|
@ -39,14 +39,14 @@ class DriveRackBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Entity
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
itemStack: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
blockAccessor: BlockGetter?,
|
||||||
p_49818_: MutableList<Component>,
|
components: MutableList<Component>,
|
||||||
p_49819_: TooltipFlag
|
tooltipType: TooltipFlag
|
||||||
) {
|
) {
|
||||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.DRIVE_RACK.rotateFromNorth(it[rotationProperty]).computeShape() }
|
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.DRIVE_RACK.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||||
|
@ -50,14 +50,14 @@ class DriveViewerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Enti
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
itemStack: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
blockAccessor: BlockGetter?,
|
||||||
p_49818_: MutableList<Component>,
|
components: MutableList<Component>,
|
||||||
p_49819_: TooltipFlag
|
tooltipType: TooltipFlag
|
||||||
) {
|
) {
|
||||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getStateForPlacement(context: BlockPlaceContext): BlockState {
|
override fun getStateForPlacement(context: BlockPlaceContext): BlockState {
|
||||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.block.storage
|
|||||||
|
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.item.TooltipFlag
|
import net.minecraft.world.item.TooltipFlag
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
@ -22,7 +23,7 @@ import ru.dbotthepony.mc.otm.core.get
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class ItemMonitorBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
class ItemMonitorBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return ItemMonitorBlockEntity(blockPos, blockState)
|
return ItemMonitorBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
@ -39,14 +40,14 @@ class ItemMonitorBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Enti
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
itemStack: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
blockAccessor: BlockGetter?,
|
||||||
p_49818_: MutableList<Component>,
|
components: MutableList<Component>,
|
||||||
p_49819_: TooltipFlag
|
tooltipType: TooltipFlag
|
||||||
) {
|
) {
|
||||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.ITEM_MONITOR.rotateFromNorth(it[rotationProperty]).computeShape() }
|
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.ITEM_MONITOR.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||||
|
@ -20,7 +20,6 @@ import net.minecraft.world.phys.shapes.Shapes
|
|||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import ru.dbotthepony.mc.otm.block.CableBlock
|
import ru.dbotthepony.mc.otm.block.CableBlock
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.block.StorageCableBlock
|
|
||||||
import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.storage.StorageBusBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.storage.StorageBusBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage
|
import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage
|
||||||
@ -55,14 +54,14 @@ class StorageBusBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Entit
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
itemStack: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
blockAccessor: BlockGetter?,
|
||||||
p_49818_: MutableList<Component>,
|
components: MutableList<Component>,
|
||||||
p_49819_: TooltipFlag
|
tooltipType: TooltipFlag
|
||||||
) {
|
) {
|
||||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||||
|
@ -20,7 +20,6 @@ import net.minecraft.world.phys.shapes.Shapes
|
|||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import ru.dbotthepony.mc.otm.block.CableBlock
|
import ru.dbotthepony.mc.otm.block.CableBlock
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.block.StorageCableBlock
|
|
||||||
import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.storage.StorageExporterBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.storage.StorageExporterBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.storage.StorageImporterBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.storage.StorageImporterBlockEntity
|
||||||
@ -80,14 +79,14 @@ class StorageImporterBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES),
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
itemStack: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
blockAccessor: BlockGetter?,
|
||||||
p_49818_: MutableList<Component>,
|
components: MutableList<Component>,
|
||||||
p_49819_: TooltipFlag
|
tooltipType: TooltipFlag
|
||||||
) {
|
) {
|
||||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val shapes = getShapeForEachState {
|
private val shapes = getShapeForEachState {
|
||||||
@ -138,14 +137,14 @@ class StorageExporterBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES),
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
itemStack: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
blockAccessor: BlockGetter?,
|
||||||
p_49818_: MutableList<Component>,
|
components: MutableList<Component>,
|
||||||
p_49819_: TooltipFlag
|
tooltipType: TooltipFlag
|
||||||
) {
|
) {
|
||||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <T : BlockEntity?> getTicker(
|
override fun <T : BlockEntity?> getTicker(
|
||||||
|
@ -39,14 +39,14 @@ class StoragePowerSupplierBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTI
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
itemStack: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
blockAccessor: BlockGetter?,
|
||||||
p_49818_: MutableList<Component>,
|
components: MutableList<Component>,
|
||||||
p_49819_: TooltipFlag
|
tooltipType: TooltipFlag
|
||||||
) {
|
) {
|
||||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.STORAGE_POWER_SUPPLIER.rotateFromNorth(it[rotationProperty]).computeShape() }
|
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.STORAGE_POWER_SUPPLIER.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.tech
|
package ru.dbotthepony.mc.otm.block.tech
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.world.item.crafting.AbstractCookingRecipe
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.item.crafting.RecipeType
|
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
@ -17,23 +16,22 @@ import net.minecraft.world.phys.shapes.Shapes
|
|||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||||
import ru.dbotthepony.mc.otm.block.entity.tech.EssenceStorageBlockEntity
|
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.PoweredFurnaceBlockEntity
|
||||||
|
import ru.dbotthepony.mc.otm.block.entity.tech.PoweredSmokerBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||||
import ru.dbotthepony.mc.otm.config.WorkerBalanceValues
|
|
||||||
import ru.dbotthepony.mc.otm.core.get
|
import ru.dbotthepony.mc.otm.core.get
|
||||||
import ru.dbotthepony.mc.otm.recipe.MatteryCookingRecipe
|
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShape
|
import ru.dbotthepony.mc.otm.shapes.BlockShape
|
||||||
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class PoweredFurnaceBlock(
|
sealed class AbstractPoweredFurnaceBlock<T : AbstractPoweredFurnaceBlockEntity<*, *>>(
|
||||||
val type: () -> BlockEntityType<PoweredFurnaceBlockEntity>,
|
val color: DyeColor?,
|
||||||
val recipeType: RecipeType<out AbstractCookingRecipe>,
|
val factory: (BlockPos, BlockState) -> T,
|
||||||
val secondaryRecipeType: (() -> RecipeType<out MatteryCookingRecipe>)?,
|
|
||||||
val config: WorkerBalanceValues,
|
|
||||||
shape: BlockShape?
|
shape: BlockShape?
|
||||||
) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): PoweredFurnaceBlockEntity {
|
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): T {
|
||||||
return PoweredFurnaceBlockEntity(type.invoke(), p_153215_, p_153216_, recipeType, secondaryRecipeType, config)
|
return factory(p_153215_, p_153216_)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||||
@ -59,6 +57,10 @@ class PoweredFurnaceBlock(
|
|||||||
if (p_153212_.isClientSide)
|
if (p_153212_.isClientSide)
|
||||||
return null
|
return null
|
||||||
|
|
||||||
return BlockEntityTicker { _, _, _, tile -> if (tile is PoweredFurnaceBlockEntity) tile.tick() }
|
return BlockEntityTicker { _, _, _, tile -> if (tile is AbstractPoweredFurnaceBlockEntity<*, *>) tile.tick() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PoweredFurnaceBlock(color: DyeColor?) : AbstractPoweredFurnaceBlock<PoweredFurnaceBlockEntity>(color, ::PoweredFurnaceBlockEntity, BlockShapes.POWERED_FURNACE)
|
||||||
|
class PoweredBlastFurnaceBlock(color: DyeColor?) : AbstractPoweredFurnaceBlock<PoweredBlastFurnaceBlockEntity>(color, ::PoweredBlastFurnaceBlockEntity, BlockShapes.POWERED_BLAST_FURNACE)
|
||||||
|
class PoweredSmokerBlock(color: DyeColor?) : AbstractPoweredFurnaceBlock<PoweredSmokerBlockEntity>(color, ::PoweredSmokerBlockEntity, BlockShapes.POWERED_SMOKER)
|
@ -139,12 +139,12 @@ class AndroidChargerBlock : RotatableMatteryBlock(Properties.of().destroyTime(2.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun appendHoverText(p_49816_: ItemStack, p_49817_: BlockGetter?, p_49818_: MutableList<Component>, p_49819_: TooltipFlag) {
|
override fun appendHoverText(itemStack: ItemStack, blockAccessor: BlockGetter?, components: MutableList<Component>, tooltipType: TooltipFlag) {
|
||||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
|
|
||||||
p_49818_.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.GRAY))
|
components.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.GRAY))
|
||||||
WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val shapes = getShapeForEachState(listOf(rotationProperty, PART)) {
|
private val shapes = getShapeForEachState(listOf(rotationProperty, PART)) {
|
||||||
|
@ -5,6 +5,7 @@ import net.minecraft.network.chat.Component
|
|||||||
import net.minecraft.world.InteractionHand
|
import net.minecraft.world.InteractionHand
|
||||||
import net.minecraft.world.InteractionResult
|
import net.minecraft.world.InteractionResult
|
||||||
import net.minecraft.world.entity.player.Player
|
import net.minecraft.world.entity.player.Player
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.item.TooltipFlag
|
import net.minecraft.world.item.TooltipFlag
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
@ -29,7 +30,7 @@ import ru.dbotthepony.mc.otm.core.orNull
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class AndroidStationBlock : MatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
class AndroidStationBlock(val color: DyeColor?) : MatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||||
override fun use(
|
override fun use(
|
||||||
blockState: BlockState,
|
blockState: BlockState,
|
||||||
level: Level,
|
level: Level,
|
||||||
@ -52,14 +53,14 @@ class AndroidStationBlock : MatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBloc
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
itemStack: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
blockAccessor: BlockGetter?,
|
||||||
p_49818_: MutableList<Component>,
|
components: MutableList<Component>,
|
||||||
p_49819_: TooltipFlag
|
tooltipType: TooltipFlag
|
||||||
) {
|
) {
|
||||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getShape(
|
override fun getShape(
|
||||||
|
@ -12,6 +12,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType
|
|||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||||
import net.minecraft.world.level.block.state.StateDefinition
|
import net.minecraft.world.level.block.state.StateDefinition
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import ru.dbotthepony.mc.otm.block.entity.tech.BatteryBankBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.tech.BatteryBankBlockEntity
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
@ -25,9 +26,7 @@ import ru.dbotthepony.mc.otm.oncePre
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
@MethodsReturnNonnullByDefault
|
class BatteryBankBlock(val color: DyeColor?) : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
||||||
@ParametersAreNonnullByDefault
|
|
||||||
class BatteryBankBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
|
||||||
override fun <T : BlockEntity> getTicker(
|
override fun <T : BlockEntity> getTicker(
|
||||||
level: Level,
|
level: Level,
|
||||||
p_153213_: BlockState,
|
p_153213_: BlockState,
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.tech
|
package ru.dbotthepony.mc.otm.block.tech
|
||||||
|
|
||||||
import net.minecraft.ChatFormatting
|
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.nbt.CompoundTag
|
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.world.item.BlockItem
|
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.item.TooltipFlag
|
import net.minecraft.world.item.TooltipFlag
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
@ -19,18 +16,11 @@ import net.minecraft.world.level.block.state.StateDefinition
|
|||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
|
||||||
import ru.dbotthepony.mc.otm.block.entity.tech.ChemicalGeneratorBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.tech.ChemicalGeneratorBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
|
|
||||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||||
import ru.dbotthepony.mc.otm.capability.energy.GeneratorEnergyStorage
|
import ru.dbotthepony.mc.otm.capability.energy.GeneratorEnergyStorage
|
||||||
import ru.dbotthepony.mc.otm.capability.energy.ItemEnergyStorageImpl
|
|
||||||
import ru.dbotthepony.mc.otm.container.MatteryContainer
|
|
||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
|
||||||
import ru.dbotthepony.mc.otm.core.get
|
import ru.dbotthepony.mc.otm.core.get
|
||||||
import ru.dbotthepony.mc.otm.core.nbt.map
|
|
||||||
import ru.dbotthepony.mc.otm.oncePre
|
|
||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
@ -57,12 +47,12 @@ class ChemicalGeneratorBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES)
|
|||||||
|
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
itemStack: ItemStack,
|
itemStack: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
blockAccessor: BlockGetter?,
|
||||||
tooltips: MutableList<Component>,
|
tooltips: MutableList<Component>,
|
||||||
p_49819_: TooltipFlag
|
tooltipType: TooltipFlag
|
||||||
) {
|
) {
|
||||||
super.appendHoverText(itemStack, p_49817_, tooltips, p_49819_)
|
super.appendHoverText(itemStack, blockAccessor, tooltips, tooltipType)
|
||||||
GeneratorEnergyStorage.appendHoverText(itemStack, p_49817_, tooltips, p_49819_)
|
GeneratorEnergyStorage.appendHoverText(itemStack, blockAccessor, tooltips, tooltipType)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.CHEMICAL_GENERATOR.rotateFromNorth(it[rotationProperty]).computeShape() }
|
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.CHEMICAL_GENERATOR.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.tech
|
package ru.dbotthepony.mc.otm.block.tech
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
import net.minecraft.world.level.block.EntityBlock
|
import net.minecraft.world.level.block.EntityBlock
|
||||||
@ -8,15 +9,18 @@ import net.minecraft.world.level.block.entity.BlockEntity
|
|||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
|
import net.minecraft.world.level.material.MapColor
|
||||||
|
import net.minecraft.world.level.material.PushReaction
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||||
import ru.dbotthepony.mc.otm.block.entity.tech.CobblerBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.tech.CobblerBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.core.get
|
import ru.dbotthepony.mc.otm.core.get
|
||||||
|
import ru.dbotthepony.mc.otm.core.needsNoPowerDescription
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class CobblerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
class CobblerBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of().mapColor(color?.mapColor ?: MapColor.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)), EntityBlock {
|
||||||
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
|
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
|
||||||
return CobblerBlockEntity(pPos, pState)
|
return CobblerBlockEntity(pPos, pState)
|
||||||
}
|
}
|
||||||
@ -33,6 +37,10 @@ class CobblerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBl
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
needsNoPowerDescription()
|
||||||
|
}
|
||||||
|
|
||||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.COBBLESTONE_GENERATOR.rotateFromNorth(it[rotationProperty]).computeShape() }
|
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.COBBLESTONE_GENERATOR.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||||
|
|
||||||
@Suppress("override_deprecation")
|
@Suppress("override_deprecation")
|
||||||
|
@ -13,6 +13,7 @@ import net.minecraft.world.level.material.MapColor
|
|||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
|
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||||
import ru.dbotthepony.mc.otm.block.entity.tech.EnergyServoBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.tech.EnergyServoBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||||
import ru.dbotthepony.mc.otm.core.get
|
import ru.dbotthepony.mc.otm.core.get
|
||||||
@ -36,6 +37,10 @@ class EnergyServoBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Enti
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
addSimpleDescription()
|
||||||
|
}
|
||||||
|
|
||||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.ENERGY_SERVO.rotateFromNorth(it[rotationProperty]).computeShape() }
|
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.ENERGY_SERVO.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||||
|
|
||||||
@Suppress("override_deprecation")
|
@Suppress("override_deprecation")
|
||||||
|
@ -4,6 +4,7 @@ import net.minecraft.core.BlockPos
|
|||||||
import net.minecraft.world.InteractionHand
|
import net.minecraft.world.InteractionHand
|
||||||
import net.minecraft.world.InteractionResult
|
import net.minecraft.world.InteractionResult
|
||||||
import net.minecraft.world.entity.player.Player
|
import net.minecraft.world.entity.player.Player
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
import net.minecraft.world.level.block.EntityBlock
|
import net.minecraft.world.level.block.EntityBlock
|
||||||
@ -11,17 +12,20 @@ import net.minecraft.world.level.block.entity.BlockEntity
|
|||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
|
import net.minecraft.world.level.material.MapColor
|
||||||
|
import net.minecraft.world.level.material.PushReaction
|
||||||
import net.minecraft.world.phys.BlockHitResult
|
import net.minecraft.world.phys.BlockHitResult
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
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.entity.tech.EssenceStorageBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||||
import ru.dbotthepony.mc.otm.core.get
|
import ru.dbotthepony.mc.otm.core.get
|
||||||
import ru.dbotthepony.mc.otm.registry.MItems
|
import ru.dbotthepony.mc.otm.registry.MItems
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class EssenceStorageBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock {
|
class EssenceStorageBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of().mapColor(color?.mapColor ?: MapColor.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(60.0f)), EntityBlock {
|
||||||
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
|
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity {
|
||||||
return EssenceStorageBlockEntity(pPos, pState)
|
return EssenceStorageBlockEntity(pPos, pState)
|
||||||
}
|
}
|
||||||
@ -43,6 +47,10 @@ class EssenceStorageBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), E
|
|||||||
return super.use(blockState, level, blockPos, ply, hand, blockHitResult)
|
return super.use(blockState, level, blockPos, ply, hand, blockHitResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
addSimpleDescription()
|
||||||
|
}
|
||||||
|
|
||||||
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.ESSENCE_STORAGE.rotateFromNorth(it[rotationProperty]).computeShape() }
|
private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.ESSENCE_STORAGE.rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||||
|
|
||||||
@Suppress("override_deprecation")
|
@Suppress("override_deprecation")
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.tech
|
package ru.dbotthepony.mc.otm.block.tech
|
||||||
|
|
||||||
|
import net.minecraft.ChatFormatting
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.core.Direction
|
import net.minecraft.core.Direction
|
||||||
import net.minecraft.core.SectionPos
|
import net.minecraft.core.SectionPos
|
||||||
@ -23,6 +24,7 @@ import net.minecraft.world.level.material.PushReaction
|
|||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
|
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||||
import ru.dbotthepony.mc.otm.block.entity.tech.GravitationStabilizerBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.tech.GravitationStabilizerBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||||
@ -30,6 +32,7 @@ import ru.dbotthepony.mc.otm.core.get
|
|||||||
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
|
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
|
||||||
import ru.dbotthepony.mc.otm.core.math.plus
|
import ru.dbotthepony.mc.otm.core.math.plus
|
||||||
import ru.dbotthepony.mc.otm.core.math.times
|
import ru.dbotthepony.mc.otm.core.math.times
|
||||||
|
import ru.dbotthepony.mc.otm.core.needsNoPowerDescription
|
||||||
import ru.dbotthepony.mc.otm.oncePre
|
import ru.dbotthepony.mc.otm.oncePre
|
||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.registry.MBlocks
|
import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||||
@ -140,6 +143,13 @@ class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock {
|
|||||||
return SHAPES[p_60555_[BlockRotationFreedom.DIRECTIONAL].ordinal]
|
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 {
|
companion object {
|
||||||
private val SHAPES = arrayOf(
|
private val SHAPES = arrayOf(
|
||||||
BlockShapes.GRAVITATION_STABILIZER.rotateAroundX(PI / 2).computeShape(),
|
BlockShapes.GRAVITATION_STABILIZER.rotateAroundX(PI / 2).computeShape(),
|
||||||
|
@ -27,10 +27,12 @@ import net.minecraft.world.phys.shapes.CollisionContext
|
|||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import net.minecraftforge.event.ForgeEventFactory
|
import net.minecraftforge.event.ForgeEventFactory
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
|
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||||
import ru.dbotthepony.mc.otm.core.get
|
import ru.dbotthepony.mc.otm.core.get
|
||||||
import ru.dbotthepony.mc.otm.core.math.minus
|
import ru.dbotthepony.mc.otm.core.math.minus
|
||||||
import ru.dbotthepony.mc.otm.core.math.plus
|
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.once
|
||||||
import ru.dbotthepony.mc.otm.registry.MBlocks
|
import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
@ -134,4 +136,9 @@ class PhantomAttractorBlock : RotatableMatteryBlock(Properties.of().mapColor(Map
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
addSimpleDescription()
|
||||||
|
needsNoPowerDescription()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.block.tech
|
|||||||
|
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.item.TooltipFlag
|
import net.minecraft.world.item.TooltipFlag
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
@ -13,18 +14,19 @@ import net.minecraft.world.level.block.entity.BlockEntityTicker
|
|||||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.block.state.StateDefinition
|
import net.minecraft.world.level.block.state.StateDefinition
|
||||||
|
import net.minecraft.world.level.material.MapColor
|
||||||
|
import net.minecraft.world.level.material.PushReaction
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.block.entity.MatteryWorkerBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.MatteryWorkerBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.tech.PlatePressBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.tech.PlatePressBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
import ru.dbotthepony.mc.otm.block.entity.WorkerState
|
||||||
import ru.dbotthepony.mc.otm.block.entity.tech.EssenceStorageBlockEntity
|
|
||||||
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
import ru.dbotthepony.mc.otm.block.getShapeForEachState
|
||||||
import ru.dbotthepony.mc.otm.core.get
|
import ru.dbotthepony.mc.otm.core.get
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class PlatePressBlock(properties: Properties = DEFAULT_MACHINE_PROPERTIES, val isTwin: Boolean = false) : RotatableMatteryBlock(properties), EntityBlock {
|
class PlatePressBlock(val color: DyeColor?, val isTwin: Boolean = false) : RotatableMatteryBlock(Properties.of().mapColor(color?.mapColor ?: MapColor.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)), EntityBlock {
|
||||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||||
return PlatePressBlockEntity(p_153215_, p_153216_, isTwin)
|
return PlatePressBlockEntity(p_153215_, p_153216_, isTwin)
|
||||||
}
|
}
|
||||||
@ -46,13 +48,13 @@ class PlatePressBlock(properties: Properties = DEFAULT_MACHINE_PROPERTIES, val i
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
itemStack: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
blockAccessor: BlockGetter?,
|
||||||
p_49818_: MutableList<Component>,
|
components: MutableList<Component>,
|
||||||
p_49819_: TooltipFlag
|
tooltipType: TooltipFlag
|
||||||
) {
|
) {
|
||||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
super.appendHoverText(itemStack, blockAccessor, components, tooltipType)
|
||||||
MatteryWorkerBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
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() }
|
private val shapes = getShapeForEachState(rotationProperty) { (if (isTwin) BlockShapes.TWIN_PLATE_PRESS_IDLE else BlockShapes.PLATE_PRESS_IDLE).rotateFromNorth(it[rotationProperty]).computeShape() }
|
||||||
|
@ -459,7 +459,8 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
var ticksIExist = 0
|
var ticksIExist = 0
|
||||||
private set
|
private set
|
||||||
|
|
||||||
private var lastOutsideLiquid = Vec3(0.0, 0.0, 0.0)
|
private var lastLiquidPosition = Vec3(0.0, 0.0, 0.0)
|
||||||
|
private var liquidDistanceTravelled = 0.0
|
||||||
private var wasInLiquid = false
|
private var wasInLiquid = false
|
||||||
private var lastDimension = ResourceLocation("overworld")
|
private var lastDimension = ResourceLocation("overworld")
|
||||||
|
|
||||||
@ -591,8 +592,9 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
savetables.int(::nextDischargeHurt)
|
savetables.int(::nextDischargeHurt)
|
||||||
savetables.int(::nextHealTick)
|
savetables.int(::nextHealTick)
|
||||||
|
|
||||||
savetables.vector(::lastOutsideLiquid)
|
savetables.vector(::lastLiquidPosition)
|
||||||
savetables.codec(::lastDimension, ResourceLocation.CODEC)
|
savetables.codec(::lastDimension, ResourceLocation.CODEC)
|
||||||
|
savetables.double(::liquidDistanceTravelled)
|
||||||
|
|
||||||
savetables.stateful(::exopackSlotModifier, "exoSuitSlotCountModifiers")
|
savetables.stateful(::exopackSlotModifier, "exoSuitSlotCountModifiers")
|
||||||
savetables.stateful(::exopackContainer, "exoSuitContainer")
|
savetables.stateful(::exopackContainer, "exoSuitContainer")
|
||||||
@ -664,7 +666,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
androidEnergy.batteryLevel = AndroidConfig.ANDROID_MAX_ENERGY
|
androidEnergy.batteryLevel = AndroidConfig.ANDROID_MAX_ENERGY
|
||||||
androidEnergy.maxBatteryLevel = AndroidConfig.ANDROID_MAX_ENERGY
|
androidEnergy.maxBatteryLevel = AndroidConfig.ANDROID_MAX_ENERGY
|
||||||
|
|
||||||
lastOutsideLiquid = ply.position()
|
lastLiquidPosition = ply.position()
|
||||||
wasInLiquid = false
|
wasInLiquid = false
|
||||||
|
|
||||||
if (ply is ServerPlayer) {
|
if (ply is ServerPlayer) {
|
||||||
@ -719,7 +721,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
androidEnergy.maxBatteryLevel = AndroidConfig.ANDROID_MAX_ENERGY
|
androidEnergy.maxBatteryLevel = AndroidConfig.ANDROID_MAX_ENERGY
|
||||||
dropBattery()
|
dropBattery()
|
||||||
|
|
||||||
lastOutsideLiquid = ply.position()
|
lastLiquidPosition = ply.position()
|
||||||
wasInLiquid = false
|
wasInLiquid = false
|
||||||
|
|
||||||
if (ply is ServerPlayer) {
|
if (ply is ServerPlayer) {
|
||||||
@ -1193,31 +1195,38 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
if (ply.airSupply < ply.maxAirSupply)
|
if (ply.airSupply < ply.maxAirSupply)
|
||||||
ply.airSupply = ply.maxAirSupply
|
ply.airSupply = ply.maxAirSupply
|
||||||
|
|
||||||
if (ply.isSwimming && !hasFeature(AndroidFeatures.AIR_BAGS))
|
if (ply.isSwimming && !hasFeature(AndroidFeatures.AIR_BAGS) && !ply.isCreative)
|
||||||
ply.isSwimming = false
|
ply.isSwimming = false
|
||||||
|
|
||||||
if (ply is ServerPlayer) {
|
if (ply is ServerPlayer) {
|
||||||
if (ply.level().dimension().location() != lastDimension) {
|
if (ply.level().dimension().location() != lastDimension) {
|
||||||
lastDimension = ply.level().dimension().location()
|
lastDimension = ply.level().dimension().location()
|
||||||
wasInLiquid = false
|
wasInLiquid = false
|
||||||
lastOutsideLiquid = ply.position
|
lastLiquidPosition = ply.position
|
||||||
|
liquidDistanceTravelled = 0.0
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ply.isUnderWater && !ply.isCreative) {
|
if (ply.isUnderWater) {
|
||||||
if (!wasInLiquid) {
|
if (!wasInLiquid) {
|
||||||
wasInLiquid = true
|
wasInLiquid = true
|
||||||
lastOutsideLiquid = ply.position
|
liquidDistanceTravelled = 0.0
|
||||||
|
lastLiquidPosition = ply.position
|
||||||
}
|
}
|
||||||
|
|
||||||
|
liquidDistanceTravelled += (ply.position - lastLiquidPosition).length()
|
||||||
} else {
|
} else {
|
||||||
if (wasInLiquid) {
|
if (wasInLiquid) {
|
||||||
wasInLiquid = false
|
wasInLiquid = false
|
||||||
|
|
||||||
if (!hasFeature(AndroidFeatures.AIR_BAGS))
|
if (!hasFeature(AndroidFeatures.AIR_BAGS)) {
|
||||||
AndroidTravelUnderwater.trigger(ply, (lastOutsideLiquid - ply.position).length())
|
AndroidTravelUnderwater.trigger(ply, liquidDistanceTravelled)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastOutsideLiquid = ply.position
|
liquidDistanceTravelled = 0.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastLiquidPosition = ply.position
|
||||||
}
|
}
|
||||||
|
|
||||||
val stats = ply.foodData
|
val stats = ply.foodData
|
||||||
|
@ -2,14 +2,62 @@ package ru.dbotthepony.mc.otm.client
|
|||||||
|
|
||||||
import net.minecraftforge.client.event.ClientPlayerNetworkEvent
|
import net.minecraftforge.client.event.ClientPlayerNetworkEvent
|
||||||
import net.minecraftforge.event.TickEvent
|
import net.minecraftforge.event.TickEvent
|
||||||
|
import net.minecraftforge.event.TickEvent.RenderTickEvent
|
||||||
|
import org.lwjgl.glfw.GLFW
|
||||||
import ru.dbotthepony.mc.otm.core.util.IConditionalTickable
|
import ru.dbotthepony.mc.otm.core.util.IConditionalTickable
|
||||||
import ru.dbotthepony.mc.otm.core.util.ITickable
|
import ru.dbotthepony.mc.otm.core.util.ITickable
|
||||||
import ru.dbotthepony.mc.otm.core.util.TickList
|
import ru.dbotthepony.mc.otm.core.util.TickList
|
||||||
|
import ru.dbotthepony.mc.otm.core.util.WriteOnce
|
||||||
import ru.dbotthepony.mc.otm.isClient
|
import ru.dbotthepony.mc.otm.isClient
|
||||||
|
import java.util.function.LongSupplier
|
||||||
|
|
||||||
private val preTickList = TickList()
|
private val preTickList = TickList()
|
||||||
private val postTickList = TickList()
|
private val postTickList = TickList()
|
||||||
|
|
||||||
|
var MODIFIED_CURSOR = false
|
||||||
|
private set
|
||||||
|
|
||||||
|
private var MODIFIED_CURSOR_FRAMES = 3
|
||||||
|
|
||||||
|
private var ARROW_CURSOR by WriteOnce<Long>()
|
||||||
|
private var BEAM_CURSOR by WriteOnce<Long>()
|
||||||
|
private var HAND_CURSOR by WriteOnce<Long>()
|
||||||
|
private var NOT_ALLOWED_CURSOR by WriteOnce<Long>()
|
||||||
|
private var CROSSHAIR_CURSOR by WriteOnce<Long>()
|
||||||
|
|
||||||
|
fun createCursors() {
|
||||||
|
ARROW_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR)
|
||||||
|
BEAM_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_IBEAM_CURSOR)
|
||||||
|
HAND_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_POINTING_HAND_CURSOR)
|
||||||
|
NOT_ALLOWED_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_NOT_ALLOWED_CURSOR)
|
||||||
|
CROSSHAIR_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_CROSSHAIR_CURSOR)
|
||||||
|
|
||||||
|
check(ARROW_CURSOR != 0L) { "Failed to create ARROW_CURSOR. Are we not on main game thread?" }
|
||||||
|
check(BEAM_CURSOR != 0L) { "Failed to create BEAM_CURSOR. Are we not on main game thread?" }
|
||||||
|
check(HAND_CURSOR != 0L) { "Failed to create HAND_CURSOR. Are we not on main game thread?" }
|
||||||
|
check(NOT_ALLOWED_CURSOR != 0L) { "Failed to create NOT_ALLOWED_CURSOR. Are we not on main game thread?" }
|
||||||
|
check(CROSSHAIR_CURSOR != 0L) { "Failed to create CROSSHAIR_CURSOR. Are we not on main game thread?" }
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class CursorType(val pointer: LongSupplier) {
|
||||||
|
ARROW(::ARROW_CURSOR), BEAM(::BEAM_CURSOR), HAND(::HAND_CURSOR), NOT_ALLOWED(::NOT_ALLOWED_CURSOR), CROSSHAIR(::CROSSHAIR_CURSOR);
|
||||||
|
|
||||||
|
fun setTo() {
|
||||||
|
GLFW.glfwSetCursor(minecraft.window.window, pointer.asLong)
|
||||||
|
MODIFIED_CURSOR = true
|
||||||
|
MODIFIED_CURSOR_FRAMES = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun onClientPostRender(event: RenderTickEvent) {
|
||||||
|
if (event.phase == TickEvent.Phase.END) {
|
||||||
|
if (MODIFIED_CURSOR_FRAMES-- <= 0 && MODIFIED_CURSOR) {
|
||||||
|
GLFW.glfwSetCursor(minecraft.window.window, ARROW_CURSOR)
|
||||||
|
MODIFIED_CURSOR = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var LOGGED_IN = false
|
var LOGGED_IN = false
|
||||||
private set
|
private set
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class HoloSignRenderer(private val context: BlockEntityRendererProvider.Context)
|
|||||||
var y = -totalHeight / 2f
|
var y = -totalHeight / 2f
|
||||||
|
|
||||||
for (line in lines) {
|
for (line in lines) {
|
||||||
font.draw(poseStack = poseStack, buffer = sorse, text = line, gravity = RenderGravity.TOP_CENTER, y = y, color = RGBAColor.YELLOW)
|
font.draw(poseStack = poseStack, buffer = sorse, text = line, gravity = RenderGravity.TOP_CENTER, y = y, color = RGBAColor(tile.textRed, tile.textGreen, tile.textBlue, tile.textAlpha))
|
||||||
y += font.lineHeight + 2f
|
y += font.lineHeight + 2f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,6 +672,9 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
panel.render(wrap, mouseXf, mouseYf, partialTick)
|
panel.render(wrap, mouseXf, mouseYf, partialTick)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!panels.asReversed().any { it.updateCursor0() })
|
||||||
|
panels.asReversed().any { it.updateCursor1() }
|
||||||
|
|
||||||
RenderSystem.depthFunc(GL11.GL_LESS)
|
RenderSystem.depthFunc(GL11.GL_LESS)
|
||||||
MinecraftForge.EVENT_BUS.post(Background(this, graphics, mouseX, mouseY))
|
MinecraftForge.EVENT_BUS.post(Background(this, graphics, mouseX, mouseY))
|
||||||
RenderSystem.disableDepthTest()
|
RenderSystem.disableDepthTest()
|
||||||
|
@ -2,15 +2,21 @@ package ru.dbotthepony.mc.otm.client.screen.decorative
|
|||||||
|
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.world.entity.player.Inventory
|
import net.minecraft.world.entity.player.Inventory
|
||||||
|
import net.minecraft.world.item.ItemStack
|
||||||
|
import ru.dbotthepony.mc.otm.client.render.ItemStackIcon
|
||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||||
|
import ru.dbotthepony.mc.otm.client.screen.panels.ColorPickerPanel
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.Dock
|
import ru.dbotthepony.mc.otm.client.screen.panels.Dock
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.DockProperty
|
import ru.dbotthepony.mc.otm.client.screen.panels.DockProperty
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.button.CheckBoxLabelInputPanel
|
import ru.dbotthepony.mc.otm.client.screen.panels.button.CheckBoxLabelInputPanel
|
||||||
|
import ru.dbotthepony.mc.otm.client.screen.panels.button.LargeRectangleButtonPanel
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls
|
import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.input.NetworkedStringInputPanel
|
import ru.dbotthepony.mc.otm.client.screen.panels.input.NetworkedStringInputPanel
|
||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
|
import ru.dbotthepony.mc.otm.core.math.RGBAColor
|
||||||
import ru.dbotthepony.mc.otm.menu.decorative.HoloSignMenu
|
import ru.dbotthepony.mc.otm.menu.decorative.HoloSignMenu
|
||||||
|
import ru.dbotthepony.mc.otm.registry.MItems
|
||||||
|
|
||||||
class HoloSignScreen(menu: HoloSignMenu, inventory: Inventory, title: Component) : MatteryScreen<HoloSignMenu>(menu, title) {
|
class HoloSignScreen(menu: HoloSignMenu, inventory: Inventory, title: Component) : MatteryScreen<HoloSignMenu>(menu, title) {
|
||||||
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
|
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
|
||||||
@ -21,14 +27,33 @@ class HoloSignScreen(menu: HoloSignMenu, inventory: Inventory, title: Component)
|
|||||||
|
|
||||||
val input = NetworkedStringInputPanel(this, frame, backend = menu.text)
|
val input = NetworkedStringInputPanel(this, frame, backend = menu.text)
|
||||||
input.dock = Dock.FILL
|
input.dock = Dock.FILL
|
||||||
input.multiLine = true
|
input.isMultiLine = true
|
||||||
|
|
||||||
val lock = CheckBoxLabelInputPanel(this, frame, menu.locked, TranslatableComponent("otm.gui.lock_holo_screen"))
|
val lock = CheckBoxLabelInputPanel(this, frame, menu.locked, TranslatableComponent("otm.gui.lock_holo_screen"))
|
||||||
lock.dock = Dock.BOTTOM
|
lock.dock = Dock.BOTTOM
|
||||||
lock.dockMargin = DockProperty(2f, 2f, 2f, 2f)
|
lock.dockMargin = DockProperty(2f, 2f, 2f, 2f)
|
||||||
lock.tooltips.add(TranslatableComponent("otm.gui.lock_holo_screen.tip"))
|
lock.tooltips.add(TranslatableComponent("otm.gui.lock_holo_screen.tip"))
|
||||||
|
|
||||||
makeDeviceControls(this, frame, redstoneConfig = menu.redstone)
|
val controls = makeDeviceControls(this, frame, redstoneConfig = menu.redstone)
|
||||||
|
|
||||||
|
controls.addButton(object : LargeRectangleButtonPanel<HoloSignScreen>(this@HoloSignScreen, frame, onPress = {
|
||||||
|
frame.blockingWindow = ColorPickerPanel.frame(
|
||||||
|
this@HoloSignScreen,
|
||||||
|
callback = {
|
||||||
|
menu.textRed.accept(it.red)
|
||||||
|
menu.textGreen.accept(it.green)
|
||||||
|
menu.textBlue.accept(it.blue)
|
||||||
|
menu.textAlpha.accept(it.alpha)
|
||||||
|
},
|
||||||
|
color = RGBAColor(menu.textRed.value, menu.textGreen.value, menu.textBlue.value, menu.textAlpha.value),
|
||||||
|
isDisabled = { !menu.textRed.and(menu.textGreen).and(menu.textBlue).and(menu.textAlpha).test(minecraft?.player) },
|
||||||
|
title = TranslatableComponent("otm.gui.change_color"))
|
||||||
|
}) {
|
||||||
|
init {
|
||||||
|
tooltips.add(TranslatableComponent("otm.gui.change_color"))
|
||||||
|
icon = ItemStackIcon(ItemStack(MItems.PAINTER)).fixed()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
return frame
|
return frame
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import net.minecraft.client.gui.screens.Screen
|
|||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||||
|
import ru.dbotthepony.mc.otm.client.CursorType
|
||||||
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
||||||
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
||||||
import ru.dbotthepony.mc.otm.client.render.sprites.MatterySprite
|
import ru.dbotthepony.mc.otm.client.render.sprites.MatterySprite
|
||||||
@ -21,6 +22,7 @@ import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
|||||||
import ru.dbotthepony.mc.otm.core.math.HSVColor
|
import ru.dbotthepony.mc.otm.core.math.HSVColor
|
||||||
import ru.dbotthepony.mc.otm.core.math.RGBAColor
|
import ru.dbotthepony.mc.otm.core.math.RGBAColor
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
|
import java.util.function.Supplier
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
open class ColorBoxPanel<out S : Screen>(
|
open class ColorBoxPanel<out S : Screen>(
|
||||||
@ -31,12 +33,16 @@ open class ColorBoxPanel<out S : Screen>(
|
|||||||
width: Float = 64f,
|
width: Float = 64f,
|
||||||
height: Float = 64f,
|
height: Float = 64f,
|
||||||
protected val callback: Consumer<HSVColor>? = null,
|
protected val callback: Consumer<HSVColor>? = null,
|
||||||
|
val isDisabled: Supplier<Boolean> = Supplier { false },
|
||||||
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
var backgroundColor = RGBAColor.RED
|
var backgroundColor = RGBAColor.RED
|
||||||
private set
|
private set
|
||||||
var markerPos = backgroundColor.toHSV()
|
var markerPos = backgroundColor.toHSV()
|
||||||
protected set
|
protected set
|
||||||
|
|
||||||
|
override val cursorType: CursorType
|
||||||
|
get() = if (isDisabled.get()) CursorType.NOT_ALLOWED else CursorType.CROSSHAIR
|
||||||
|
|
||||||
fun setColor(color: Either<RGBAColor, HSVColor>) {
|
fun setColor(color: Either<RGBAColor, HSVColor>) {
|
||||||
color.map(
|
color.map(
|
||||||
{ markerPos = it.toHSV(); if (it.canRepresentHue()) backgroundColor = HSVColor(it.toHSV().hue, 1f, 1f).toRGBA() },
|
{ markerPos = it.toHSV(); if (it.canRepresentHue()) backgroundColor = HSVColor(it.toHSV().hue, 1f, 1f).toRGBA() },
|
||||||
@ -66,7 +72,7 @@ open class ColorBoxPanel<out S : Screen>(
|
|||||||
|
|
||||||
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
if (button == InputConstants.MOUSE_BUTTON_LEFT) {
|
if (button == InputConstants.MOUSE_BUTTON_LEFT) {
|
||||||
if (!isPressed) {
|
if (!isPressed && !isDisabled.get()) {
|
||||||
isPressed = true
|
isPressed = true
|
||||||
grabMouseInput = true
|
grabMouseInput = true
|
||||||
|
|
||||||
@ -81,7 +87,7 @@ open class ColorBoxPanel<out S : Screen>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseDraggedInner(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double): Boolean {
|
override fun mouseDraggedInner(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double): Boolean {
|
||||||
if (isPressed && button == InputConstants.MOUSE_BUTTON_LEFT) {
|
if (isPressed && button == InputConstants.MOUSE_BUTTON_LEFT && !isDisabled.get()) {
|
||||||
pickColor(x, y)
|
pickColor(x, y)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -135,13 +141,18 @@ abstract class AbstractColorWangPanel<out S : Screen>(
|
|||||||
width: Float = 40f,
|
width: Float = 40f,
|
||||||
height: Float = 10f,
|
height: Float = 10f,
|
||||||
protected val callback: Consumer<RGBAColor>? = null,
|
protected val callback: Consumer<RGBAColor>? = null,
|
||||||
|
val isDisabled: Supplier<Boolean> = Supplier { false },
|
||||||
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
abstract val leftColor: RGBAColor
|
abstract val leftColor: RGBAColor
|
||||||
abstract val rightColor: RGBAColor
|
abstract val rightColor: RGBAColor
|
||||||
abstract val wangPosition: Float
|
abstract val wangPosition: Float
|
||||||
abstract fun setColor(color: Either<RGBAColor, HSVColor>)
|
abstract fun setColor(color: Either<RGBAColor, HSVColor>)
|
||||||
|
|
||||||
protected abstract fun onWangInput(newPosition: Float)
|
protected abstract fun onWangInput(newPosition: Float)
|
||||||
|
|
||||||
|
override val cursorType: CursorType
|
||||||
|
get() = if (isDisabled.get()) CursorType.NOT_ALLOWED else CursorType.ARROW
|
||||||
|
|
||||||
init {
|
init {
|
||||||
scissor = true
|
scissor = true
|
||||||
}
|
}
|
||||||
@ -155,7 +166,7 @@ abstract class AbstractColorWangPanel<out S : Screen>(
|
|||||||
|
|
||||||
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
if (button == InputConstants.MOUSE_BUTTON_LEFT) {
|
if (button == InputConstants.MOUSE_BUTTON_LEFT) {
|
||||||
if (!isPressed) {
|
if (!isPressed && !isDisabled.get()) {
|
||||||
isPressed = true
|
isPressed = true
|
||||||
grabMouseInput = true
|
grabMouseInput = true
|
||||||
|
|
||||||
@ -170,7 +181,7 @@ abstract class AbstractColorWangPanel<out S : Screen>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseDraggedInner(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double): Boolean {
|
override fun mouseDraggedInner(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double): Boolean {
|
||||||
if (isPressed && button == InputConstants.MOUSE_BUTTON_LEFT) {
|
if (isPressed && button == InputConstants.MOUSE_BUTTON_LEFT && !isDisabled.get()) {
|
||||||
updateColor(x)
|
updateColor(x)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -216,7 +227,8 @@ open class RedColorWangPanel<out S : Screen>(
|
|||||||
width: Float = 40f,
|
width: Float = 40f,
|
||||||
height: Float = 10f,
|
height: Float = 10f,
|
||||||
callback: Consumer<RGBAColor>? = null,
|
callback: Consumer<RGBAColor>? = null,
|
||||||
) : AbstractColorWangPanel<S>(screen, parent, x, y, width, height, callback) {
|
isDisabled: Supplier<Boolean> = Supplier { false },
|
||||||
|
) : AbstractColorWangPanel<S>(screen, parent, x, y, width, height, callback, isDisabled) {
|
||||||
override var leftColor: RGBAColor = RGBAColor.BLACK
|
override var leftColor: RGBAColor = RGBAColor.BLACK
|
||||||
protected set
|
protected set
|
||||||
override var rightColor: RGBAColor = RGBAColor.RED
|
override var rightColor: RGBAColor = RGBAColor.RED
|
||||||
@ -247,7 +259,8 @@ open class GreenColorWangPanel<out S : Screen>(
|
|||||||
width: Float = 40f,
|
width: Float = 40f,
|
||||||
height: Float = 10f,
|
height: Float = 10f,
|
||||||
callback: Consumer<RGBAColor>? = null,
|
callback: Consumer<RGBAColor>? = null,
|
||||||
) : AbstractColorWangPanel<S>(screen, parent, x, y, width, height, callback) {
|
isDisabled: Supplier<Boolean> = Supplier { false },
|
||||||
|
) : AbstractColorWangPanel<S>(screen, parent, x, y, width, height, callback, isDisabled) {
|
||||||
override var leftColor: RGBAColor = RGBAColor.BLACK
|
override var leftColor: RGBAColor = RGBAColor.BLACK
|
||||||
protected set
|
protected set
|
||||||
override var rightColor: RGBAColor = RGBAColor.GREEN
|
override var rightColor: RGBAColor = RGBAColor.GREEN
|
||||||
@ -278,7 +291,8 @@ open class BlueColorWangPanel<out S : Screen>(
|
|||||||
width: Float = 40f,
|
width: Float = 40f,
|
||||||
height: Float = 10f,
|
height: Float = 10f,
|
||||||
callback: Consumer<RGBAColor>? = null,
|
callback: Consumer<RGBAColor>? = null,
|
||||||
) : AbstractColorWangPanel<S>(screen, parent, x, y, width, height, callback) {
|
isDisabled: Supplier<Boolean> = Supplier { false },
|
||||||
|
) : AbstractColorWangPanel<S>(screen, parent, x, y, width, height, callback, isDisabled) {
|
||||||
override var leftColor: RGBAColor = RGBAColor.BLACK
|
override var leftColor: RGBAColor = RGBAColor.BLACK
|
||||||
protected set
|
protected set
|
||||||
override var rightColor: RGBAColor = RGBAColor.BLUE
|
override var rightColor: RGBAColor = RGBAColor.BLUE
|
||||||
@ -309,7 +323,8 @@ open class HueWangPanel<out S : Screen>(
|
|||||||
width: Float = 40f,
|
width: Float = 40f,
|
||||||
height: Float = 10f,
|
height: Float = 10f,
|
||||||
protected val hueCallback: FloatConsumer? = null,
|
protected val hueCallback: FloatConsumer? = null,
|
||||||
) : AbstractColorWangPanel<S>(screen, parent, x, y, width, height) {
|
isDisabled: Supplier<Boolean> = Supplier { false },
|
||||||
|
) : AbstractColorWangPanel<S>(screen, parent, x, y, width, height, null, isDisabled) {
|
||||||
override val leftColor: RGBAColor get() = RGBAColor.WHITE
|
override val leftColor: RGBAColor get() = RGBAColor.WHITE
|
||||||
override val rightColor: RGBAColor get() = RGBAColor.WHITE
|
override val rightColor: RGBAColor get() = RGBAColor.WHITE
|
||||||
override var wangPosition: Float = 1f
|
override var wangPosition: Float = 1f
|
||||||
@ -351,7 +366,8 @@ open class SaturationWangPanel<out S : Screen>(
|
|||||||
width: Float = 40f,
|
width: Float = 40f,
|
||||||
height: Float = 10f,
|
height: Float = 10f,
|
||||||
protected val saturationCallback: FloatConsumer? = null,
|
protected val saturationCallback: FloatConsumer? = null,
|
||||||
) : AbstractColorWangPanel<S>(screen, parent, x, y, width, height) {
|
isDisabled: Supplier<Boolean> = Supplier { false },
|
||||||
|
) : AbstractColorWangPanel<S>(screen, parent, x, y, width, height, null, isDisabled) {
|
||||||
override var leftColor: RGBAColor = RGBAColor.WHITE
|
override var leftColor: RGBAColor = RGBAColor.WHITE
|
||||||
protected set
|
protected set
|
||||||
override var rightColor: RGBAColor = RGBAColor.WHITE
|
override var rightColor: RGBAColor = RGBAColor.WHITE
|
||||||
@ -396,7 +412,8 @@ open class ValueWangPanel<out S : Screen>(
|
|||||||
width: Float = 40f,
|
width: Float = 40f,
|
||||||
height: Float = 10f,
|
height: Float = 10f,
|
||||||
protected val valueCallback: FloatConsumer? = null,
|
protected val valueCallback: FloatConsumer? = null,
|
||||||
) : AbstractColorWangPanel<S>(screen, parent, x, y, width, height) {
|
isDisabled: Supplier<Boolean> = Supplier { false }
|
||||||
|
) : AbstractColorWangPanel<S>(screen, parent, x, y, width, height, null, isDisabled) {
|
||||||
override var leftColor: RGBAColor = RGBAColor.BLACK
|
override var leftColor: RGBAColor = RGBAColor.BLACK
|
||||||
protected set
|
protected set
|
||||||
override var rightColor: RGBAColor = RGBAColor.WHITE
|
override var rightColor: RGBAColor = RGBAColor.WHITE
|
||||||
@ -440,7 +457,8 @@ open class ColorPalettePanel<out S : Screen>(
|
|||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = 64f,
|
width: Float = 64f,
|
||||||
height: Float = 64f,
|
height: Float = 64f,
|
||||||
protected val callback: Consumer<RGBAColor>? = null
|
protected val callback: Consumer<RGBAColor>? = null,
|
||||||
|
val isDisabled: Supplier<Boolean> = Supplier { false }
|
||||||
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
open fun onColorChoose(color: RGBAColor) {
|
open fun onColorChoose(color: RGBAColor) {
|
||||||
callback?.accept(color)
|
callback?.accept(color)
|
||||||
@ -452,6 +470,10 @@ open class ColorPalettePanel<out S : Screen>(
|
|||||||
tooltips.add(TextComponent(color.toHexStringRGB()))
|
tooltips.add(TextComponent(color.toHexStringRGB()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override var isDisabled: Boolean
|
||||||
|
get() = this@ColorPalettePanel.isDisabled.get()
|
||||||
|
set(value) {}
|
||||||
|
|
||||||
override fun onClick(mouseButton: Int) {
|
override fun onClick(mouseButton: Int) {
|
||||||
onColorChoose(color)
|
onColorChoose(color)
|
||||||
}
|
}
|
||||||
@ -499,7 +521,8 @@ open class ColorPickerPanel<out S : Screen>(
|
|||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = 164f,
|
width: Float = 164f,
|
||||||
height: Float = 118f,
|
height: Float = 118f,
|
||||||
var callback: Consumer<RGBAColor>? = null
|
var callback: Consumer<RGBAColor>? = null,
|
||||||
|
val isDisabled: Supplier<Boolean> = Supplier { false },
|
||||||
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
open fun onColorChanged(color: RGBAColor) {
|
open fun onColorChanged(color: RGBAColor) {
|
||||||
callback?.accept(color)
|
callback?.accept(color)
|
||||||
@ -523,49 +546,56 @@ open class ColorPickerPanel<out S : Screen>(
|
|||||||
|
|
||||||
protected open fun onPaletteChoose(color: RGBAColor) {
|
protected open fun onPaletteChoose(color: RGBAColor) {
|
||||||
setColor(Either.left(color))
|
setColor(Either.left(color))
|
||||||
onColorChanged(color)
|
if (!isDisabled.get()) onColorChanged(color)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun onColorBoxChoose(color: HSVColor) {
|
protected open fun onColorBoxChoose(color: HSVColor) {
|
||||||
setColor(Either.right(color))
|
setColor(Either.right(color))
|
||||||
onColorChanged(color.toRGBA())
|
if (!isDisabled.get()) onColorChanged(color.toRGBA())
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun onWangChoose(color: RGBAColor) {
|
protected open fun onWangChoose(color: RGBAColor) {
|
||||||
setColor(Either.left(color))
|
setColor(Either.left(color))
|
||||||
onColorChanged(color)
|
if (!isDisabled.get()) onColorChanged(color)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun onHueChoose(hue: Float) {
|
protected open fun onHueChoose(hue: Float) {
|
||||||
val current = currentColor.map({ it.toHSV() }, { it })
|
val current = currentColor.map({ it.toHSV() }, { it })
|
||||||
val new = current.copy(hue = hue)
|
val new = current.copy(hue = hue)
|
||||||
setColor(Either.right(new))
|
setColor(Either.right(new))
|
||||||
onColorChanged(new.toRGBA())
|
if (!isDisabled.get()) onColorChanged(new.toRGBA())
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun onSaturationChoose(saturation: Float) {
|
protected open fun onSaturationChoose(saturation: Float) {
|
||||||
val current = currentColor.map({ it.toHSV() }, { it })
|
val current = currentColor.map({ it.toHSV() }, { it })
|
||||||
val new = current.copy(saturation = saturation)
|
val new = current.copy(saturation = saturation)
|
||||||
setColor(Either.right(new))
|
setColor(Either.right(new))
|
||||||
onColorChanged(new.toRGBA())
|
if (!isDisabled.get()) onColorChanged(new.toRGBA())
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun onValueChoose(value: Float) {
|
protected open fun onValueChoose(value: Float) {
|
||||||
val current = currentColor.map({ it.toHSV() }, { it })
|
val current = currentColor.map({ it.toHSV() }, { it })
|
||||||
val new = current.copy(value = value)
|
val new = current.copy(value = value)
|
||||||
setColor(Either.right(new))
|
setColor(Either.right(new))
|
||||||
onColorChanged(new.toRGBA())
|
if (!isDisabled.get()) onColorChanged(new.toRGBA())
|
||||||
}
|
}
|
||||||
|
|
||||||
val topStrip = EditablePanel(screen, this, 0f, 0f, width = width, height = 70f)
|
val topStrip = EditablePanel(screen, this, 0f, 0f, width = width, height = 70f)
|
||||||
val middleStrip = EditablePanel(screen, this)
|
val middleStrip = EditablePanel(screen, this)
|
||||||
val palette = ColorPalettePanel(screen, this, callback = { onPaletteChoose(it) })
|
val palette = ColorPalettePanel(screen, this, callback = { onPaletteChoose(it) }, isDisabled = isDisabled)
|
||||||
|
|
||||||
|
override val cursorType: CursorType
|
||||||
|
get() = if (isDisabled.get()) CursorType.NOT_ALLOWED else CursorType.ARROW
|
||||||
|
|
||||||
val hexInput = object : TextInputPanel<S>(screen, middleStrip, width = 50f) {
|
val hexInput = object : TextInputPanel<S>(screen, middleStrip, width = 50f) {
|
||||||
init {
|
init {
|
||||||
dock = Dock.RIGHT
|
dock = Dock.RIGHT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override var isActive: Boolean
|
||||||
|
get() = !isDisabled.get()
|
||||||
|
set(value) {}
|
||||||
|
|
||||||
override fun onFocusChanged() {
|
override fun onFocusChanged() {
|
||||||
if (!isFocusedThis) {
|
if (!isFocusedThis) {
|
||||||
val newColor = RGBAColor.fromHexStringRGB(text)
|
val newColor = RGBAColor.fromHexStringRGB(text)
|
||||||
@ -574,7 +604,7 @@ open class ColorPickerPanel<out S : Screen>(
|
|||||||
text = currentColor.map({ it }, { it.toRGBA() }).toHexStringRGB()
|
text = currentColor.map({ it }, { it.toRGBA() }).toHexStringRGB()
|
||||||
} else {
|
} else {
|
||||||
setColor(Either.left(newColor))
|
setColor(Either.left(newColor))
|
||||||
onColorChanged(newColor)
|
if (!isDisabled.get()) onColorChanged(newColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -596,7 +626,7 @@ open class ColorPickerPanel<out S : Screen>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val box = ColorBoxPanel(screen, topStrip, 0f, 0f, width = 70f, height = 70f, callback = { onColorBoxChoose(it) })
|
val box = ColorBoxPanel(screen, topStrip, 0f, 0f, width = 70f, height = 70f, callback = { onColorBoxChoose(it) }, isDisabled = isDisabled)
|
||||||
val wangCanvas = EditablePanel(screen, topStrip, width = 80f)
|
val wangCanvas = EditablePanel(screen, topStrip, width = 80f)
|
||||||
|
|
||||||
inner class WangLine(label: String, val wang: AbstractColorWangPanel<S>, val text: (color: Either<RGBAColor, HSVColor>) -> Component?) {
|
inner class WangLine(label: String, val wang: AbstractColorWangPanel<S>, val text: (color: Either<RGBAColor, HSVColor>) -> Component?) {
|
||||||
@ -637,13 +667,13 @@ open class ColorPickerPanel<out S : Screen>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val red = WangLine("red", RedColorWangPanel(screen, wangCanvas, callback = { onWangChoose(it) })) { TextComponent((it.map({ it }, { it.toRGBA() }).red * 255f).roundToInt().toString()) }
|
val red = WangLine("red", RedColorWangPanel(screen, wangCanvas, callback = { onWangChoose(it) }, isDisabled = isDisabled)) { TextComponent((it.map({ it }, { it.toRGBA() }).red * 255f).roundToInt().toString()) }
|
||||||
val green = WangLine("green", GreenColorWangPanel(screen, wangCanvas, callback = { onWangChoose(it) })) { TextComponent((it.map({ it }, { it.toRGBA() }).green * 255f).roundToInt().toString()) }
|
val green = WangLine("green", GreenColorWangPanel(screen, wangCanvas, callback = { onWangChoose(it) }, isDisabled = isDisabled)) { TextComponent((it.map({ it }, { it.toRGBA() }).green * 255f).roundToInt().toString()) }
|
||||||
val blue = WangLine("blue", BlueColorWangPanel(screen, wangCanvas, callback = { onWangChoose(it) })) { TextComponent((it.map({ it }, { it.toRGBA() }).blue * 255f).roundToInt().toString()) }
|
val blue = WangLine("blue", BlueColorWangPanel(screen, wangCanvas, callback = { onWangChoose(it) }, isDisabled = isDisabled)) { TextComponent((it.map({ it }, { it.toRGBA() }).blue * 255f).roundToInt().toString()) }
|
||||||
|
|
||||||
val hue = WangLine("hue", HueWangPanel(screen, wangCanvas, hueCallback = { onHueChoose(it) })) { it.map({ if (it.canRepresentHue()) it.toHSV() else null }, { it })?.let { TextComponent(it.hue.roundToInt().toString()) } }
|
val hue = WangLine("hue", HueWangPanel(screen, wangCanvas, hueCallback = { onHueChoose(it) }, isDisabled = isDisabled)) { it.map({ if (it.canRepresentHue()) it.toHSV() else null }, { it })?.let { TextComponent(it.hue.roundToInt().toString()) } }
|
||||||
val saturation = WangLine("saturation", SaturationWangPanel(screen, wangCanvas, saturationCallback = { onSaturationChoose(it) })) { it.map({ if (it.canRepresentHue()) it.toHSV() else null }, { it })?.let { TextComponent((it.saturation * 100f).roundToInt().toString() + "%") } }
|
val saturation = WangLine("saturation", SaturationWangPanel(screen, wangCanvas, saturationCallback = { onSaturationChoose(it) }, isDisabled = isDisabled)) { it.map({ if (it.canRepresentHue()) it.toHSV() else null }, { it })?.let { TextComponent((it.saturation * 100f).roundToInt().toString() + "%") } }
|
||||||
val value = WangLine("value", ValueWangPanel(screen, wangCanvas, valueCallback = { onValueChoose(it) })) { it.map({ if (it.canRepresentHue()) it.toHSV() else null }, { it })?.let { TextComponent((it.value * 100f).roundToInt().toString() + "%") } }
|
val value = WangLine("value", ValueWangPanel(screen, wangCanvas, valueCallback = { onValueChoose(it) }, isDisabled = isDisabled)) { it.map({ if (it.canRepresentHue()) it.toHSV() else null }, { it })?.let { TextComponent((it.value * 100f).roundToInt().toString() + "%") } }
|
||||||
|
|
||||||
val wangs = listOf(red, green, blue, hue, saturation, value)
|
val wangs = listOf(red, green, blue, hue, saturation, value)
|
||||||
|
|
||||||
@ -728,9 +758,9 @@ open class ColorPickerPanel<out S : Screen>(
|
|||||||
RGBAColor.rgb(0xEE82EEL), // Violet
|
RGBAColor.rgb(0xEE82EEL), // Violet
|
||||||
)
|
)
|
||||||
|
|
||||||
fun <S : MatteryScreen<*>> frame(screen: S, callback: Consumer<RGBAColor>, color: RGBAColor = RGBAColor.RED, title: Component? = TranslatableComponent("otm.gui.color_picker")): FramePanel<S> {
|
fun <S : MatteryScreen<*>> frame(screen: S, callback: Consumer<RGBAColor>, color: RGBAColor = RGBAColor.RED, title: Component? = TranslatableComponent("otm.gui.color_picker"), isDisabled: Supplier<Boolean> = Supplier { false }): FramePanel<S> {
|
||||||
return FramePanel.padded(screen, 164f, 118f, title).also {
|
return FramePanel.padded(screen, 164f, 118f, title).also {
|
||||||
ColorPickerPanel(screen, it, 0f, 0f, callback = callback).also {
|
ColorPickerPanel(screen, it, 0f, 0f, callback = callback, isDisabled = isDisabled).also {
|
||||||
it.dock = Dock.FILL
|
it.dock = Dock.FILL
|
||||||
it.setColor(Either.left(color))
|
it.setColor(Either.left(color))
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import net.minecraft.world.inventory.Slot
|
|||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import org.apache.logging.log4j.LogManager
|
import org.apache.logging.log4j.LogManager
|
||||||
import ru.dbotthepony.mc.otm.SystemTime
|
import ru.dbotthepony.mc.otm.SystemTime
|
||||||
|
import ru.dbotthepony.mc.otm.client.CursorType
|
||||||
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
||||||
import ru.dbotthepony.mc.otm.client.minecraft
|
import ru.dbotthepony.mc.otm.client.minecraft
|
||||||
import ru.dbotthepony.mc.otm.client.moveMousePosScaled
|
import ru.dbotthepony.mc.otm.client.moveMousePosScaled
|
||||||
@ -421,6 +422,7 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
var acceptMouseInput = true
|
var acceptMouseInput = true
|
||||||
var acceptKeyboardInput = true
|
var acceptKeyboardInput = true
|
||||||
var grabMouseInput = false
|
var grabMouseInput = false
|
||||||
|
open val cursorType: CursorType get() = CursorType.ARROW
|
||||||
|
|
||||||
fun tryToGrabMouseInput(): Boolean {
|
fun tryToGrabMouseInput(): Boolean {
|
||||||
if (grabMouseInput) {
|
if (grabMouseInput) {
|
||||||
@ -900,6 +902,24 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun updateCursor0(): Boolean {
|
||||||
|
if (grabMouseInput) {
|
||||||
|
cursorType.setTo()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return children.any { it.updateCursor0() }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateCursor1(): Boolean {
|
||||||
|
if (isHovered) {
|
||||||
|
cursorType.setTo()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return children.any { it.updateCursor1() }
|
||||||
|
}
|
||||||
|
|
||||||
fun updateAbsolutePosition() {
|
fun updateAbsolutePosition() {
|
||||||
val parent = parent
|
val parent = parent
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button
|
|||||||
|
|
||||||
import com.mojang.blaze3d.platform.InputConstants
|
import com.mojang.blaze3d.platform.InputConstants
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
|
import ru.dbotthepony.mc.otm.client.CursorType
|
||||||
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
||||||
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
||||||
@ -30,6 +31,9 @@ abstract class AbstractButtonPanel<out S : Screen>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val cursorType: CursorType
|
||||||
|
get() = if (isDisabled) CursorType.NOT_ALLOWED else CursorType.ARROW
|
||||||
|
|
||||||
override fun test(value: Int): Boolean {
|
override fun test(value: Int): Boolean {
|
||||||
return value == InputConstants.MOUSE_BUTTON_LEFT
|
return value == InputConstants.MOUSE_BUTTON_LEFT
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.input
|
|||||||
|
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
|
import ru.dbotthepony.mc.otm.client.CursorType
|
||||||
import ru.dbotthepony.mc.otm.client.minecraft
|
import ru.dbotthepony.mc.otm.client.minecraft
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
||||||
import ru.dbotthepony.mc.otm.core.TextComponent
|
import ru.dbotthepony.mc.otm.core.TextComponent
|
||||||
@ -14,7 +15,7 @@ open class NetworkNumberInputPanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
parent: EditablePanel<*>?,
|
parent: EditablePanel<*>?,
|
||||||
val networkValue: () -> BigDecimal,
|
val networkValue: () -> BigDecimal,
|
||||||
val callback: (BigDecimal) -> Unit,
|
val callback: (BigDecimal) -> Unit,
|
||||||
val isAvailable: BooleanSupplier = BooleanSupplier { true },
|
val isEnabled: BooleanSupplier = BooleanSupplier { true },
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = 0f,
|
width: Float = 0f,
|
||||||
@ -35,7 +36,7 @@ open class NetworkNumberInputPanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
screen = screen,
|
screen = screen,
|
||||||
parent = parent,
|
parent = parent,
|
||||||
callback = widget::accept,
|
callback = widget::accept,
|
||||||
isAvailable = { widget.allowSpectators || minecraft.player?.isSpectator != true },
|
isEnabled = { widget.allowSpectators || minecraft.player?.isSpectator != true },
|
||||||
networkValue = networkValue,
|
networkValue = networkValue,
|
||||||
x = x,
|
x = x,
|
||||||
y = y,
|
y = y,
|
||||||
@ -48,7 +49,7 @@ open class NetworkNumberInputPanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
protected var inputStr = ""
|
protected var inputStr = ""
|
||||||
|
|
||||||
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
if (!isAvailable.asBoolean) {
|
if (!isEnabled.asBoolean) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ open class NetworkNumberInputPanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
super.tickInner()
|
super.tickInner()
|
||||||
|
|
||||||
if (isFocusedThis) {
|
if (isFocusedThis) {
|
||||||
if (!isAvailable.asBoolean) {
|
if (!isEnabled.asBoolean) {
|
||||||
killFocus()
|
killFocus()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -70,7 +71,7 @@ open class NetworkNumberInputPanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
if (nextUpdateFromServer < System.currentTimeMillis()) {
|
if (nextUpdateFromServer < System.currentTimeMillis()) {
|
||||||
getOrCreateWidget().value = networkValue.invoke().toPlainString()
|
getOrCreateWidget().value = networkValue.invoke().toPlainString()
|
||||||
inputStr = getOrCreateWidget().value
|
inputStr = getOrCreateWidget().value
|
||||||
} else if (isAvailable.asBoolean) {
|
} else if (isEnabled.asBoolean) {
|
||||||
if (inputStr != getOrCreateWidget().value) {
|
if (inputStr != getOrCreateWidget().value) {
|
||||||
inputStr = getOrCreateWidget().value
|
inputStr = getOrCreateWidget().value
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import net.minecraft.client.gui.screens.Screen
|
|||||||
import net.minecraft.client.renderer.GameRenderer
|
import net.minecraft.client.renderer.GameRenderer
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import org.joml.Vector2i
|
import org.joml.Vector2i
|
||||||
|
import ru.dbotthepony.mc.otm.client.CursorType
|
||||||
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
||||||
import ru.dbotthepony.mc.otm.client.isCtrlDown
|
import ru.dbotthepony.mc.otm.client.isCtrlDown
|
||||||
import ru.dbotthepony.mc.otm.client.isShiftDown
|
import ru.dbotthepony.mc.otm.client.isShiftDown
|
||||||
@ -85,19 +86,19 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
private val cursorLine = this@TextInputPanel.cursorLine
|
private val cursorLine = this@TextInputPanel.cursorLine
|
||||||
private val cursorCharacter = this@TextInputPanel.cursorRow
|
private val cursorCharacter = this@TextInputPanel.cursorRow
|
||||||
private val selections = Int2ObjectAVLTreeMap(this@TextInputPanel.selections)
|
private val selections = Int2ObjectAVLTreeMap(this@TextInputPanel.selections)
|
||||||
private val multiLine = this@TextInputPanel.multiLine
|
private val multiLine = this@TextInputPanel.isMultiLine
|
||||||
|
|
||||||
fun apply() {
|
fun apply() {
|
||||||
this@TextInputPanel.lines.clear()
|
this@TextInputPanel.lines.clear()
|
||||||
|
|
||||||
if (this@TextInputPanel.multiLine)
|
if (this@TextInputPanel.isMultiLine)
|
||||||
this@TextInputPanel.lines.addAll(lines)
|
this@TextInputPanel.lines.addAll(lines)
|
||||||
else
|
else
|
||||||
this@TextInputPanel.lines.add(lines.joinToString(""))
|
this@TextInputPanel.lines.add(lines.joinToString(""))
|
||||||
|
|
||||||
|
|
||||||
this@TextInputPanel.selections.clear()
|
this@TextInputPanel.selections.clear()
|
||||||
if (this@TextInputPanel.multiLine && multiLine)
|
if (this@TextInputPanel.isMultiLine && multiLine)
|
||||||
this@TextInputPanel.selections.putAll(selections)
|
this@TextInputPanel.selections.putAll(selections)
|
||||||
|
|
||||||
this@TextInputPanel.cursorRow = cursorCharacter
|
this@TextInputPanel.cursorRow = cursorCharacter
|
||||||
@ -128,7 +129,7 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
var debugDraw = false
|
var debugDraw = false
|
||||||
var multiLine = false
|
var isMultiLine = false
|
||||||
set(value) {
|
set(value) {
|
||||||
if (field == value) return
|
if (field == value) return
|
||||||
|
|
||||||
@ -151,6 +152,9 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
open var backgroundColor = RGBAColor.BLACK
|
open var backgroundColor = RGBAColor.BLACK
|
||||||
open var isActive = true
|
open var isActive = true
|
||||||
|
|
||||||
|
override val cursorType: CursorType
|
||||||
|
get() = if (isActive) CursorType.BEAM else CursorType.NOT_ALLOWED
|
||||||
|
|
||||||
init {
|
init {
|
||||||
scissor = true
|
scissor = true
|
||||||
dockPadding = DockProperty(2f, 2f, 2f, 2f)
|
dockPadding = DockProperty(2f, 2f, 2f, 2f)
|
||||||
@ -275,7 +279,7 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
if (index < 0)
|
if (index < 0)
|
||||||
throw IndexOutOfBoundsException("negative index $index")
|
throw IndexOutOfBoundsException("negative index $index")
|
||||||
|
|
||||||
if (!multiLine && index != 0)
|
if (!isMultiLine && index != 0)
|
||||||
throw IllegalStateException("Not accepting newlines")
|
throw IllegalStateException("Not accepting newlines")
|
||||||
|
|
||||||
lines.ensureCapacity(index)
|
lines.ensureCapacity(index)
|
||||||
@ -301,7 +305,7 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun insertLine(index: Int, value: String = "") {
|
fun insertLine(index: Int, value: String = "") {
|
||||||
if (!multiLine && lines.isNotEmpty())
|
if (!isMultiLine && lines.isNotEmpty())
|
||||||
throw IllegalStateException("Not accepting newlines")
|
throw IllegalStateException("Not accepting newlines")
|
||||||
|
|
||||||
lines.ensureCapacity(index)
|
lines.ensureCapacity(index)
|
||||||
@ -457,7 +461,7 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
cursorRow = 0
|
cursorRow = 0
|
||||||
textCache = null
|
textCache = null
|
||||||
|
|
||||||
if (multiLine) {
|
if (isMultiLine) {
|
||||||
lines.addAll(value.split(NEWLINES))
|
lines.addAll(value.split(NEWLINES))
|
||||||
} else {
|
} else {
|
||||||
lines.add(value.replace(NEWLINES, ""))
|
lines.add(value.replace(NEWLINES, ""))
|
||||||
@ -664,7 +668,7 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (key == InputConstants.KEY_RETURN) {
|
if (key == InputConstants.KEY_RETURN) {
|
||||||
if (multiLine) {
|
if (isMultiLine) {
|
||||||
if (!minecraft.window.isShiftDown && !minecraft.window.isCtrlDown)
|
if (!minecraft.window.isShiftDown && !minecraft.window.isCtrlDown)
|
||||||
wipeSelection()
|
wipeSelection()
|
||||||
|
|
||||||
@ -901,7 +905,7 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
wipeSelection()
|
wipeSelection()
|
||||||
pushbackSnapshot()
|
pushbackSnapshot()
|
||||||
|
|
||||||
if (multiLine) {
|
if (isMultiLine) {
|
||||||
var index = cursorRow + (0 until cursorLine).iterator().map { this[it]?.length ?: 0 }.reduce(0, Int::plus)
|
var index = cursorRow + (0 until cursorLine).iterator().map { this[it]?.length ?: 0 }.reduce(0, Int::plus)
|
||||||
val insert = minecraft.keyboardHandler.clipboard.replace("\t", " ").filter { acceptsCharacter(it, 0, index++) }.split(NEWLINES).toMutableList()
|
val insert = minecraft.keyboardHandler.clipboard.replace("\t", " ").filter { acceptsCharacter(it, 0, index++) }.split(NEWLINES).toMutableList()
|
||||||
val actualLastSize = insert.lastOrNull()?.length ?: 0
|
val actualLastSize = insert.lastOrNull()?.length ?: 0
|
||||||
@ -1064,7 +1068,7 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
|
|
||||||
wipeSelection()
|
wipeSelection()
|
||||||
|
|
||||||
if (!multiLine)
|
if (!isMultiLine)
|
||||||
cursorLine = 0
|
cursorLine = 0
|
||||||
|
|
||||||
var line = this[cursorLine]
|
var line = this[cursorLine]
|
||||||
@ -1121,7 +1125,7 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
|
|
||||||
var topPadding = dockPadding.top
|
var topPadding = dockPadding.top
|
||||||
|
|
||||||
if (multiLine) {
|
if (isMultiLine) {
|
||||||
val heightInLines = ((height - dockPadding.top - dockPadding.bottom) / (font.lineHeight + rowSpacing)).toInt()
|
val heightInLines = ((height - dockPadding.top - dockPadding.bottom) / (font.lineHeight + rowSpacing)).toInt()
|
||||||
|
|
||||||
if (heightInLines > 0) {
|
if (heightInLines > 0) {
|
||||||
@ -1297,6 +1301,8 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
|
|
||||||
isSelecting = true
|
isSelecting = true
|
||||||
tryToGrabMouseInput()
|
tryToGrabMouseInput()
|
||||||
|
} else if (button == InputConstants.MOUSE_BUTTON_RIGHT && !isMultiLine) {
|
||||||
|
text = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.util
|
|||||||
|
|
||||||
import com.mojang.blaze3d.platform.InputConstants
|
import com.mojang.blaze3d.platform.InputConstants
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
|
import ru.dbotthepony.mc.otm.client.CursorType
|
||||||
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel
|
import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel
|
||||||
@ -26,6 +27,9 @@ open class AnalogScrollBarPanel<out S : Screen>(
|
|||||||
var isScrolling = false
|
var isScrolling = false
|
||||||
private set
|
private set
|
||||||
|
|
||||||
|
override val cursorType: CursorType
|
||||||
|
get() = if (maxScroll.invoke(this@AnalogScrollBarPanel) <= 0) CursorType.NOT_ALLOWED else CursorType.ARROW
|
||||||
|
|
||||||
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (this@AnalogScrollBarPanel.width == ScrollBarConstants.SLIM_WIDTH) {
|
if (this@AnalogScrollBarPanel.width == ScrollBarConstants.SLIM_WIDTH) {
|
||||||
if (isScrolling) {
|
if (isScrolling) {
|
||||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.util
|
|||||||
|
|
||||||
import com.mojang.blaze3d.platform.InputConstants
|
import com.mojang.blaze3d.platform.InputConstants
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
|
import ru.dbotthepony.mc.otm.client.CursorType
|
||||||
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
@ -20,6 +21,9 @@ open class DiscreteScrollBarPanel<out S : Screen>(
|
|||||||
var isScrolling = false
|
var isScrolling = false
|
||||||
private set
|
private set
|
||||||
|
|
||||||
|
override val cursorType: CursorType
|
||||||
|
get() = if (maxScroll.invoke(this@DiscreteScrollBarPanel) <= 0) CursorType.NOT_ALLOWED else CursorType.ARROW
|
||||||
|
|
||||||
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (this@DiscreteScrollBarPanel.width == ScrollBarConstants.SLIM_WIDTH) {
|
if (this@DiscreteScrollBarPanel.width == ScrollBarConstants.SLIM_WIDTH) {
|
||||||
if (isScrolling) {
|
if (isScrolling) {
|
||||||
|
@ -15,6 +15,7 @@ import ru.dbotthepony.mc.otm.android.AndroidResearchManager
|
|||||||
import ru.dbotthepony.mc.otm.android.AndroidResearchType
|
import ru.dbotthepony.mc.otm.android.AndroidResearchType
|
||||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
||||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
||||||
|
import ru.dbotthepony.mc.otm.client.CursorType
|
||||||
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
||||||
import ru.dbotthepony.mc.otm.client.minecraft
|
import ru.dbotthepony.mc.otm.client.minecraft
|
||||||
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
||||||
@ -284,6 +285,9 @@ private class AndroidResearchButton(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val cursorType: CursorType
|
||||||
|
get() = if (node.isAnyBlockerResearchedIndirect && !(parent?.screen as AndroidStationScreen).menu.player.isCreative) CursorType.NOT_ALLOWED else if (node.canResearch && !node.isResearched) CursorType.HAND else CursorType.ARROW
|
||||||
|
|
||||||
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
val hovered = screen.hoveredResearch
|
val hovered = screen.hoveredResearch
|
||||||
|
|
||||||
@ -394,12 +398,13 @@ private class AndroidResearchButton(
|
|||||||
MatteryPlayerNetworkChannel.sendToServer(AndroidResearchRequestPacket(node.type))
|
MatteryPlayerNetworkChannel.sendToServer(AndroidResearchRequestPacket(node.type))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} else {
|
|
||||||
MatteryPlayerNetworkChannel.sendToServer(AndroidResearchRequestPacket(node.type))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
playGuiClickSound()
|
playGuiClickSound()
|
||||||
|
} else {
|
||||||
|
MatteryPlayerNetworkChannel.sendToServer(AndroidResearchRequestPacket(node.type))
|
||||||
|
playGuiClickSound()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
@ -273,7 +273,7 @@ class EssenceStorageScreen(menu: EssenceStorageMenu, inventory: Inventory, title
|
|||||||
it.tooltips.add(Enchantments.MENDING.getFullname(1).copy().withStyle(ChatFormatting.GRAY))
|
it.tooltips.add(Enchantments.MENDING.getFullname(1).copy().withStyle(ChatFormatting.GRAY))
|
||||||
}
|
}
|
||||||
|
|
||||||
makeDeviceControls(this, frame, redstoneConfig = menu.redstoneConfig, itemConfig = menu.itemConfig)
|
makeDeviceControls(this, frame, redstoneConfig = menu.redstoneConfig, itemConfig = menu.itemConfig, fluidConfig = menu.fluidConfig)
|
||||||
|
|
||||||
return frame
|
return frame
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ open class ProfiledMatterGaugePanel<out S : Screen>(
|
|||||||
profiledWidget.weightedTransfer,
|
profiledWidget.weightedTransfer,
|
||||||
))
|
))
|
||||||
|
|
||||||
if (minecraft.window.isShiftDown && minecraft.options.advancedItemTooltips) {
|
if (minecraft.window.isShiftDown) {
|
||||||
it.add(TextComponent("---"))
|
it.add(TextComponent("---"))
|
||||||
val values = IntArrayList()
|
val values = IntArrayList()
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ open class ProfiledPowerGaugePanel<out S : Screen>(
|
|||||||
profiledWidget.weightedTransfer,
|
profiledWidget.weightedTransfer,
|
||||||
))
|
))
|
||||||
|
|
||||||
if (minecraft.window.isShiftDown && minecraft.options.advancedItemTooltips) {
|
if (minecraft.window.isShiftDown) {
|
||||||
it.add(TextComponent("---"))
|
it.add(TextComponent("---"))
|
||||||
val values = IntArrayList()
|
val values = IntArrayList()
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import mezz.jei.api.recipe.RecipeType
|
|||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
|
import ru.dbotthepony.mc.otm.client.CursorType
|
||||||
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
||||||
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
||||||
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
||||||
@ -94,6 +95,9 @@ open class ProgressGaugePanel<out S : Screen>(
|
|||||||
return recipeTypeSupplier != null && value == InputConstants.MOUSE_BUTTON_LEFT
|
return recipeTypeSupplier != null && value == InputConstants.MOUSE_BUTTON_LEFT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val cursorType: CursorType
|
||||||
|
get() = if (recipeTypeSupplier != null) CursorType.HAND else CursorType.ARROW
|
||||||
|
|
||||||
override fun onClick(mouseButton: Int) {
|
override fun onClick(mouseButton: Int) {
|
||||||
val recipeTypeSupplier = recipeTypeSupplier ?: return
|
val recipeTypeSupplier = recipeTypeSupplier ?: return
|
||||||
JEIPlugin.RUNTIME.recipesGui.showTypes(recipeTypeSupplier.get())
|
JEIPlugin.RUNTIME.recipesGui.showTypes(recipeTypeSupplier.get())
|
||||||
|
@ -66,14 +66,15 @@ class JEIPlugin : IModPlugin {
|
|||||||
|
|
||||||
override fun registerRecipeCatalysts(registration: IRecipeCatalystRegistration) {
|
override fun registerRecipeCatalysts(registration: IRecipeCatalystRegistration) {
|
||||||
registration.addRecipeCatalyst(ItemStack(MItems.CHEMICAL_GENERATOR), RecipeTypes.FUELING)
|
registration.addRecipeCatalyst(ItemStack(MItems.CHEMICAL_GENERATOR), RecipeTypes.FUELING)
|
||||||
registration.addRecipeCatalyst(ItemStack(MItems.POWERED_FURNACE), RecipeTypes.SMELTING)
|
registration.addRecipeCatalyst(ItemStack(MItems.POWERED_FURNACE[null]!!), RecipeTypes.SMELTING)
|
||||||
registration.addRecipeCatalyst(ItemStack(MItems.ExopackUpgrades.SMELTING_UPGRADE), RecipeTypes.SMELTING)
|
registration.addRecipeCatalyst(ItemStack(MItems.ExopackUpgrades.SMELTING_UPGRADE), RecipeTypes.SMELTING)
|
||||||
registration.addRecipeCatalyst(ItemStack(MItems.POWERED_BLAST_FURNACE), RecipeTypes.BLASTING)
|
registration.addRecipeCatalyst(ItemStack(MItems.POWERED_BLAST_FURNACE[null]!!), RecipeTypes.BLASTING)
|
||||||
registration.addRecipeCatalyst(ItemStack(MItems.POWERED_SMOKER), RecipeTypes.SMOKING)
|
registration.addRecipeCatalyst(ItemStack(MItems.POWERED_SMOKER[null]!!), RecipeTypes.SMOKING)
|
||||||
registration.addRecipeCatalyst(ItemStack(MItems.POWERED_SMOKER), MicrowaveRecipeCategory.recipeType)
|
MItems.POWERED_SMOKER.values.forEach { registration.addRecipeCatalyst(ItemStack(it), MicrowaveRecipeCategory.recipeType) }
|
||||||
registration.addRecipeCatalyst(ItemStack(MItems.ExopackUpgrades.CRAFTING_UPGRADE), RecipeTypes.CRAFTING)
|
registration.addRecipeCatalyst(ItemStack(MItems.ExopackUpgrades.CRAFTING_UPGRADE), RecipeTypes.CRAFTING)
|
||||||
registration.addRecipeCatalyst(ItemStack(MItems.ITEM_MONITOR), RecipeTypes.CRAFTING)
|
registration.addRecipeCatalyst(ItemStack(MItems.ITEM_MONITOR[null]!!), RecipeTypes.CRAFTING)
|
||||||
registration.addRecipeCatalyst(ItemStack(MItems.PLATE_PRESS), PlatePressRecipeCategory.recipeType)
|
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.PAINTER), PainterRecipeCategory.recipeType)
|
||||||
registration.addRecipeCatalyst(ItemStack(MItems.MATTER_ENTANGLER), MatterEntanglerRecipeCategory.recipeType)
|
registration.addRecipeCatalyst(ItemStack(MItems.MATTER_ENTANGLER), MatterEntanglerRecipeCategory.recipeType)
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ object MicrowaveRecipeCategory : IRecipeCategory<MicrowaveRecipe>, IDrawable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getTitle(): Component {
|
override fun getTitle(): Component {
|
||||||
return MItems.POWERED_SMOKER.description
|
return MItems.POWERED_SMOKER[null]!!.description
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun draw(graphics: GuiGraphics, xOffset: Int, yOffset: Int) {
|
override fun draw(graphics: GuiGraphics, xOffset: Int, yOffset: Int) {
|
||||||
@ -95,7 +95,7 @@ object MicrowaveRecipeCategory : IRecipeCategory<MicrowaveRecipe>, IDrawable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val iconField by lazy {
|
private val iconField by lazy {
|
||||||
JEIPlugin.helpers.guiHelper.createDrawableItemStack(ItemStack(MItems.POWERED_SMOKER))
|
JEIPlugin.helpers.guiHelper.createDrawableItemStack(ItemStack(MItems.POWERED_SMOKER[null]!!))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getIcon(): IDrawable {
|
override fun getIcon(): IDrawable {
|
||||||
|
@ -42,7 +42,7 @@ object PlatePressRecipeCategory : IRecipeCategory<PlatePressRecipe>, IDrawable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getTitle(): Component {
|
override fun getTitle(): Component {
|
||||||
return MItems.PLATE_PRESS.description
|
return MItems.PLATE_PRESS[null]!!.description
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun draw(graphics: GuiGraphics, xOffset: Int, yOffset: Int) {
|
override fun draw(graphics: GuiGraphics, xOffset: Int, yOffset: Int) {
|
||||||
@ -96,7 +96,7 @@ object PlatePressRecipeCategory : IRecipeCategory<PlatePressRecipe>, IDrawable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val iconField by lazy {
|
private val iconField by lazy {
|
||||||
JEIPlugin.helpers.guiHelper.createDrawableItemStack(ItemStack(MItems.PLATE_PRESS))
|
JEIPlugin.helpers.guiHelper.createDrawableItemStack(ItemStack(MItems.PLATE_PRESS[null]!!))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getIcon(): IDrawable {
|
override fun getIcon(): IDrawable {
|
||||||
|
@ -212,7 +212,7 @@ object MachinesConfig : AbstractConfig("machines") {
|
|||||||
|
|
||||||
val MAX_ENERGY by builder
|
val MAX_ENERGY by builder
|
||||||
.comment("Maximal combined energy consumption percentage")
|
.comment("Maximal combined energy consumption percentage")
|
||||||
.defineDecimal("MAX_ENERGY", Decimal.LONG_MAX_VALUE, Decimal.ZERO)
|
.defineDecimal("MAX_ENERGY", Decimal.POSITIVE_INFINITY, Decimal.ZERO)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
builder.pop()
|
builder.pop()
|
||||||
|
@ -16,32 +16,38 @@ open class UpgradeContainer(slotCount: Int, open val allowedUpgrades: Set<Upgrad
|
|||||||
final override val upgradeTypes: Set<UpgradeType>
|
final override val upgradeTypes: Set<UpgradeType>
|
||||||
get() = setOf()
|
get() = setOf()
|
||||||
|
|
||||||
protected fun decimals(fn: (IMatteryUpgrade) -> Decimal, reducer: (Decimal, Decimal) -> Decimal): Decimal {
|
protected fun positiveDecimals(fn: (IMatteryUpgrade) -> Decimal, reducer: (Decimal, Decimal) -> Decimal): Decimal {
|
||||||
return iterator()
|
return iterator()
|
||||||
.map { it.getCapability(MatteryCapability.UPGRADE).map(fn).orElse(Decimal.ZERO).moreThanZero() * it.count }
|
.map { it.getCapability(MatteryCapability.UPGRADE).map(fn).orElse(Decimal.ZERO).moreThanZero() * it.count }
|
||||||
.reduce(Decimal.ZERO, reducer)
|
.reduce(Decimal.ZERO, reducer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected fun anyDecimals(fn: (IMatteryUpgrade) -> Decimal, reducer: (Decimal, Decimal) -> Decimal): Decimal {
|
||||||
|
return iterator()
|
||||||
|
.map { it.getCapability(MatteryCapability.UPGRADE).map(fn).orElse(Decimal.ZERO) * it.count }
|
||||||
|
.reduce(Decimal.ZERO, reducer)
|
||||||
|
}
|
||||||
|
|
||||||
override val speedBonus: Double
|
override val speedBonus: Double
|
||||||
get() = iterator().map { it.getCapability(MatteryCapability.UPGRADE).map { it.speedBonus }.orElse(0.0) * it.count }.reduce(0.0) { a, b -> a + b }
|
get() = iterator().map { it.getCapability(MatteryCapability.UPGRADE).map { it.speedBonus }.orElse(0.0) * it.count }.reduce(0.0) { a, b -> a + b }
|
||||||
override val processingItems: Int
|
override val processingItems: Int
|
||||||
get() = iterator().map { it.getCapability(MatteryCapability.UPGRADE).map { it.processingItems }.orElse(0).coerceAtLeast(0) * it.count }.reduce(0) { a, b -> a + b }
|
get() = iterator().map { it.getCapability(MatteryCapability.UPGRADE).map { it.processingItems }.orElse(0).coerceAtLeast(0) * it.count }.reduce(0) { a, b -> a + b }
|
||||||
override val energyStorageFlat: Decimal
|
override val energyStorageFlat: Decimal
|
||||||
get() = decimals(IMatteryUpgrade::energyStorageFlat, Decimal::plus)
|
get() = positiveDecimals(IMatteryUpgrade::energyStorageFlat, Decimal::plus)
|
||||||
override val energyStorage: Decimal
|
override val energyStorage: Decimal
|
||||||
get() = decimals(IMatteryUpgrade::energyStorage, Decimal::plus)
|
get() = positiveDecimals(IMatteryUpgrade::energyStorage, Decimal::plus)
|
||||||
override val matterStorageFlat: Decimal
|
override val matterStorageFlat: Decimal
|
||||||
get() = decimals(IMatteryUpgrade::matterStorageFlat, Decimal::plus)
|
get() = positiveDecimals(IMatteryUpgrade::matterStorageFlat, Decimal::plus)
|
||||||
override val matterStorage: Decimal
|
override val matterStorage: Decimal
|
||||||
get() = decimals(IMatteryUpgrade::matterStorage, Decimal::plus)
|
get() = positiveDecimals(IMatteryUpgrade::matterStorage, Decimal::plus)
|
||||||
override val energyConsumed: Decimal
|
override val energyConsumed: Decimal
|
||||||
get() = decimals(IMatteryUpgrade::energyConsumed, Decimal::plus)
|
get() = anyDecimals(IMatteryUpgrade::energyConsumed, Decimal::plus)
|
||||||
override val failureMultiplier: Double
|
override val failureMultiplier: Double
|
||||||
get() = iterator().map { it.getCapability(MatteryCapability.UPGRADE).map { it.failureMultiplier }.orElse(1.0).coerceAtLeast(0.0).pow(it.count.toDouble()) }.reduce(1.0) { a, b -> a * b }
|
get() = iterator().map { it.getCapability(MatteryCapability.UPGRADE).map { it.failureMultiplier }.orElse(1.0).coerceAtLeast(0.0).pow(it.count.toDouble()) }.reduce(1.0) { a, b -> a * b }
|
||||||
override val energyThroughputFlat: Decimal
|
override val energyThroughputFlat: Decimal
|
||||||
get() = decimals(IMatteryUpgrade::energyThroughputFlat, Decimal::plus)
|
get() = positiveDecimals(IMatteryUpgrade::energyThroughputFlat, Decimal::plus)
|
||||||
override val energyThroughput: Decimal
|
override val energyThroughput: Decimal
|
||||||
get() = decimals(IMatteryUpgrade::energyThroughput, Decimal::plus)
|
get() = positiveDecimals(IMatteryUpgrade::energyThroughput, Decimal::plus)
|
||||||
|
|
||||||
fun transform(values: EnergyBalanceValues): EnergyBalanceValues {
|
fun transform(values: EnergyBalanceValues): EnergyBalanceValues {
|
||||||
return object : EnergyBalanceValues {
|
return object : EnergyBalanceValues {
|
||||||
|
@ -69,6 +69,28 @@ fun FriendlyByteBuf.writeBigInteger(value: BigInteger) {
|
|||||||
|
|
||||||
fun FriendlyByteBuf.readBigInteger(byteLimit: Int = 128) = BigInteger(readByteArray(byteLimit))
|
fun FriendlyByteBuf.readBigInteger(byteLimit: Int = 128) = BigInteger(readByteArray(byteLimit))
|
||||||
|
|
||||||
|
fun <V> Map<*, V>.asLambdaSupplierArray(): Array<() -> V> {
|
||||||
|
val result = arrayOfNulls<() -> V>(size)
|
||||||
|
var i = 0
|
||||||
|
|
||||||
|
for (k in keys) {
|
||||||
|
result[i++] = { this[k] ?: throw ConcurrentModificationException("Key $k is no longer present in map $this") }
|
||||||
|
}
|
||||||
|
|
||||||
|
return result as Array<() -> V>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <V> Map<*, V>.asSupplierArray(): Array<Supplier<V>> {
|
||||||
|
val result = arrayOfNulls<Supplier<V>>(size)
|
||||||
|
var i = 0
|
||||||
|
|
||||||
|
for (k in keys) {
|
||||||
|
result[i++] = { this[k] ?: throw ConcurrentModificationException("Key $k is no longer present in map $this") }
|
||||||
|
}
|
||||||
|
|
||||||
|
return result as Array<Supplier<V>>
|
||||||
|
}
|
||||||
|
|
||||||
operator fun IItemHandler.get(index: Int): ItemStack = getStackInSlot(index)
|
operator fun IItemHandler.get(index: Int): ItemStack = getStackInSlot(index)
|
||||||
|
|
||||||
operator fun JsonObject.set(s: String, value: JsonElement) = add(s, value)
|
operator fun JsonObject.set(s: String, value: JsonElement) = add(s, value)
|
||||||
|
100
src/main/kotlin/ru/dbotthepony/mc/otm/core/ITooltippable.kt
Normal file
100
src/main/kotlin/ru/dbotthepony/mc/otm/core/ITooltippable.kt
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
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))
|
||||||
|
}
|
@ -4,26 +4,22 @@ import java.util.function.Supplier
|
|||||||
import java.util.stream.Stream
|
import java.util.stream.Stream
|
||||||
|
|
||||||
class SupplierList<T> : AbstractList<T> {
|
class SupplierList<T> : AbstractList<T> {
|
||||||
private val getters: Array<() -> T>
|
private val getters: Array<Supplier<T>>
|
||||||
|
|
||||||
constructor(vararg getters: () -> T) : super() {
|
constructor(getters: Collection<Supplier<T>>) : super() {
|
||||||
this.getters = Array(getters.size) { getters[it] }
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(getters: Collection<() -> T>) : super() {
|
|
||||||
val iterator = getters.iterator()
|
val iterator = getters.iterator()
|
||||||
this.getters = Array(getters.size) { iterator.next() }
|
this.getters = Array(getters.size) { iterator.next() }
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(getters: Stream<() -> T>) : super() {
|
constructor(getters: Stream<Supplier<T>>) : super() {
|
||||||
this.getters = getters.toArray(::arrayOfNulls)
|
this.getters = getters.toArray(::arrayOfNulls)
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(vararg getters: Supplier<T>) : super() {
|
constructor(vararg getters: Supplier<T>) : super() {
|
||||||
this.getters = Array(getters.size) { getters[it]::get }
|
this.getters = Array(getters.size) { getters[it] }
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(size: Int, provider: (Int) -> () -> T) {
|
constructor(size: Int, provider: (Int) -> Supplier<T>) {
|
||||||
this.getters = Array(size, provider)
|
this.getters = Array(size, provider)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,6 +27,6 @@ class SupplierList<T> : AbstractList<T> {
|
|||||||
get() = getters.size
|
get() = getters.size
|
||||||
|
|
||||||
override fun get(index: Int): T {
|
override fun get(index: Int): T {
|
||||||
return getters[index].invoke()
|
return getters[index].get()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
package ru.dbotthepony.mc.otm.core.collect
|
package ru.dbotthepony.mc.otm.core.collect
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet
|
import com.google.common.collect.ImmutableSet
|
||||||
|
import java.util.function.Supplier
|
||||||
import java.util.stream.Stream
|
import java.util.stream.Stream
|
||||||
|
|
||||||
class SupplierMap<K, T> : AbstractMap<K, T> {
|
class SupplierMap<K, T> : AbstractMap<K, T> {
|
||||||
override val entries: Set<Map.Entry<K, T>>
|
override val entries: Set<Map.Entry<K, T>>
|
||||||
|
|
||||||
constructor(vararg mValues: Pair<K, () -> T>) : super() {
|
constructor(vararg mValues: Pair<K, Supplier<T>>) : super() {
|
||||||
entries = ImmutableSet.copyOf(mValues.map { Entry(it.first, it.second) })
|
entries = ImmutableSet.copyOf(mValues.map { Entry(it.first, it.second) })
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(mValues: Collection<Pair<K, () -> T>>) : super() {
|
constructor(mValues: Collection<Pair<K, Supplier<T>>>) : super() {
|
||||||
entries = ImmutableSet.copyOf(mValues.map { Entry(it.first, it.second) })
|
entries = ImmutableSet.copyOf(mValues.map { Entry(it.first, it.second) })
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(mValues: Stream<Pair<K, () -> T>>) : super() {
|
constructor(mValues: Stream<Pair<K, Supplier<T>>>) : super() {
|
||||||
entries = mValues.map { Entry(it.first, it.second) }.collect(ImmutableSet.toImmutableSet())
|
entries = mValues.map { Entry(it.first, it.second) }.collect(ImmutableSet.toImmutableSet())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,9 +25,9 @@ class SupplierMap<K, T> : AbstractMap<K, T> {
|
|||||||
|
|
||||||
private inner class Entry(
|
private inner class Entry(
|
||||||
override val key: K,
|
override val key: K,
|
||||||
private val getter: () -> T
|
private val getter: Supplier<T>
|
||||||
) : Map.Entry<K, T> {
|
) : Map.Entry<K, T> {
|
||||||
override val value: T
|
override val value: T
|
||||||
get() = getter.invoke()
|
get() = getter.get()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,9 @@ enum class BlockRotationFreedom(vararg values: BlockRotation) {
|
|||||||
BlockRotation.SOUTH_DOWN,
|
BlockRotation.SOUTH_DOWN,
|
||||||
BlockRotation.WEST_DOWN,
|
BlockRotation.WEST_DOWN,
|
||||||
BlockRotation.EAST_DOWN,
|
BlockRotation.EAST_DOWN,
|
||||||
);
|
),
|
||||||
|
|
||||||
|
NONE(BlockRotation.NORTH);
|
||||||
|
|
||||||
val possibleValues: Collection<BlockRotation> get() = property.possibleValues
|
val possibleValues: Collection<BlockRotation> get() = property.possibleValues
|
||||||
val property: EnumProperty<BlockRotation> = EnumProperty.create("facing", BlockRotation::class.java, *values)
|
val property: EnumProperty<BlockRotation> = EnumProperty.create("facing", BlockRotation::class.java, *values)
|
||||||
@ -66,14 +68,14 @@ enum class BlockRotationFreedom(vararg values: BlockRotation) {
|
|||||||
private val twoDirection = EnumMap<Direction, EnumMap<Direction, BlockRotation>>(Direction::class.java)
|
private val twoDirection = EnumMap<Direction, EnumMap<Direction, BlockRotation>>(Direction::class.java)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
for (direction in Direction.values()) {
|
for (direction in Direction.entries) {
|
||||||
oneDirection[direction] = possibleValues.firstOrNull { it.front == direction }
|
oneDirection[direction] = possibleValues.firstOrNull { it.front == direction }
|
||||||
?: possibleValues.first()
|
?: possibleValues.first()
|
||||||
|
|
||||||
val second = EnumMap<Direction, BlockRotation>(Direction::class.java)
|
val second = EnumMap<Direction, BlockRotation>(Direction::class.java)
|
||||||
twoDirection[direction] = second
|
twoDirection[direction] = second
|
||||||
|
|
||||||
for (direction2 in Direction.values()) {
|
for (direction2 in Direction.entries) {
|
||||||
second[direction2] = possibleValues.firstOrNull { it.front == direction && it.top == direction2 }
|
second[direction2] = possibleValues.firstOrNull { it.front == direction && it.top == direction2 }
|
||||||
?: possibleValues.firstOrNull { it.front == direction }
|
?: possibleValues.firstOrNull { it.front == direction }
|
||||||
?: possibleValues.first()
|
?: possibleValues.first()
|
||||||
|
@ -31,7 +31,7 @@ import ru.dbotthepony.mc.otm.core.math.Vector
|
|||||||
import ru.dbotthepony.mc.otm.entity.MinecartCargoCrate
|
import ru.dbotthepony.mc.otm.entity.MinecartCargoCrate
|
||||||
import ru.dbotthepony.mc.otm.registry.MEntityTypes
|
import ru.dbotthepony.mc.otm.registry.MEntityTypes
|
||||||
|
|
||||||
class ChestUpgraderItem : Item(Properties().stacksTo(1)) {
|
class ChestUpgraderItem : MatteryItem(Properties().stacksTo(1)) {
|
||||||
override fun onItemUseFirst(stack: ItemStack, context: UseOnContext): InteractionResult {
|
override fun onItemUseFirst(stack: ItemStack, context: UseOnContext): InteractionResult {
|
||||||
val player = context.player ?: return super.onItemUseFirst(stack, context)
|
val player = context.player ?: return super.onItemUseFirst(stack, context)
|
||||||
|
|
||||||
@ -105,17 +105,12 @@ class ChestUpgraderItem : Item(Properties().stacksTo(1)) {
|
|||||||
return super.onItemUseFirst(stack, context)
|
return super.onItemUseFirst(stack, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun appendHoverText(pStack: ItemStack, pLevel: Level?, pTooltip: MutableList<Component>, pFlag: TooltipFlag) {
|
init {
|
||||||
super.appendHoverText(pStack, pLevel, pTooltip, pFlag)
|
addSimpleDescription()
|
||||||
|
addSimpleDescription("2")
|
||||||
pTooltip.add(DESCRIPTION)
|
|
||||||
pTooltip.add(DESCRIPTION2)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val DESCRIPTION = TranslatableComponent("item.${MOD_ID}.chest_upgrader.desc").withStyle(ChatFormatting.DARK_GRAY)
|
|
||||||
private val DESCRIPTION2= TranslatableComponent("item.${MOD_ID}.chest_upgrader.desc2").withStyle(ChatFormatting.DARK_GRAY)
|
|
||||||
|
|
||||||
fun onEntityInteract(event: PlayerInteractEvent.EntityInteract) {
|
fun onEntityInteract(event: PlayerInteractEvent.EntityInteract) {
|
||||||
if (event.target !is MinecartChest) return
|
if (event.target !is MinecartChest) return
|
||||||
|
|
||||||
|
@ -22,22 +22,22 @@ import ru.dbotthepony.mc.otm.core.tagNotNull
|
|||||||
import ru.dbotthepony.mc.otm.core.util.getLevelFromXp
|
import ru.dbotthepony.mc.otm.core.util.getLevelFromXp
|
||||||
import ru.dbotthepony.mc.otm.runIfClient
|
import ru.dbotthepony.mc.otm.runIfClient
|
||||||
|
|
||||||
class EssenceCapsuleItem(private val digital: Boolean) : Item(Properties().stacksTo(1).rarity(Rarity.UNCOMMON)) {
|
class EssenceCapsuleItem(private val digital: Boolean) : MatteryItem(Properties().stacksTo(1).rarity(Rarity.UNCOMMON)) {
|
||||||
override fun appendHoverText(pStack: ItemStack, pLevel: Level?, pTooltipComponents: MutableList<Component>, pIsAdvanced: TooltipFlag) {
|
override fun appendHoverText(itemStack: ItemStack, level: Level?, components: MutableList<Component>, tooltipType: TooltipFlag) {
|
||||||
super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced)
|
super.appendHoverText(itemStack, level, components, tooltipType)
|
||||||
pTooltipComponents.add(TranslatableComponent("otm.gui.essence_capsule").withStyle(ChatFormatting.DARK_GRAY))
|
components.add(TranslatableComponent("otm.gui.essence_capsule").withStyle(ChatFormatting.DARK_GRAY))
|
||||||
pTooltipComponents.add(TranslatableComponent("otm.gui.essence_capsule2").withStyle(ChatFormatting.DARK_GRAY))
|
components.add(TranslatableComponent("otm.gui.essence_capsule2").withStyle(ChatFormatting.DARK_GRAY))
|
||||||
|
|
||||||
if (!digital) {
|
if (!digital) {
|
||||||
pTooltipComponents.add(TranslatableComponent("otm.gui.essence_capsule3").withStyle(ChatFormatting.DARK_GRAY))
|
components.add(TranslatableComponent("otm.gui.essence_capsule3").withStyle(ChatFormatting.DARK_GRAY))
|
||||||
} else if (runIfClient(false) { minecraft.player?.matteryPlayer?.isAndroid ?: false }) {
|
} else if (runIfClient(false) { minecraft.player?.matteryPlayer?.isAndroid == true }) {
|
||||||
pTooltipComponents.add(TranslatableComponent("otm.gui.essence_capsule.digital").withStyle(ChatFormatting.DARK_GRAY))
|
components.add(TranslatableComponent("otm.gui.essence_capsule.digital").withStyle(ChatFormatting.DARK_GRAY))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runIfClient(false) { minecraft.window.isShiftDown }) {
|
if (runIfClient(false) { minecraft.window.isShiftDown }) {
|
||||||
pTooltipComponents.add(TranslatableComponent("otm.gui.experience", experienceStored(pStack)).withStyle(ChatFormatting.GRAY))
|
components.add(TranslatableComponent("otm.gui.experience", experienceStored(itemStack)).withStyle(ChatFormatting.GRAY))
|
||||||
} else {
|
} else {
|
||||||
pTooltipComponents.add(TranslatableComponent("otm.gui.experience_levels", getLevelFromXp(experienceStored(pStack))).withStyle(ChatFormatting.GRAY))
|
components.add(TranslatableComponent("otm.gui.experience_levels", getLevelFromXp(experienceStored(itemStack))).withStyle(ChatFormatting.GRAY))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,11 +14,10 @@ import net.minecraft.world.level.Level
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.tech.EssenceStorageBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.tech.EssenceStorageBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
|
|
||||||
class EssenceServoItem : Item(Properties().stacksTo(64)) {
|
class EssenceServoItem : MatteryItem(Properties().stacksTo(64)) {
|
||||||
override fun appendHoverText(pStack: ItemStack, pLevel: Level?, pTooltipComponents: MutableList<Component>, pIsAdvanced: TooltipFlag) {
|
init {
|
||||||
super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced)
|
addSimpleDescription("2")
|
||||||
pTooltipComponents.add(TranslatableComponent("$descriptionId.desc2").withStyle(ChatFormatting.GRAY))
|
addSimpleDescription(formatting = ChatFormatting.DARK_GRAY)
|
||||||
pTooltipComponents.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.DARK_GRAY))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun useServo(player: Player, pos: BlockPos): InteractionResult {
|
fun useServo(player: Player, pos: BlockPos): InteractionResult {
|
||||||
|
28
src/main/kotlin/ru/dbotthepony/mc/otm/item/MatteryItem.kt
Normal file
28
src/main/kotlin/ru/dbotthepony/mc/otm/item/MatteryItem.kt
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.item
|
||||||
|
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectIterators
|
||||||
|
import net.minecraft.ChatFormatting
|
||||||
|
import net.minecraft.network.chat.Component
|
||||||
|
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.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() {
|
||||||
|
override fun appendHoverText(itemStack: ItemStack, level: Level?, components: MutableList<Component>, tooltipType: TooltipFlag) {
|
||||||
|
super.appendHoverText(itemStack, level, components, tooltipType)
|
||||||
|
assembleDescription(itemStack, components)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T : MatteryItem> T.addSimpleDescription(suffix: String = "", formatting: ChatFormatting = ChatFormatting.GRAY): T {
|
||||||
|
return addDescriptionFunctions { ObjectIterators.singleton(TranslatableComponent("$descriptionId.desc$suffix").withStyle(formatting)) }
|
||||||
|
}
|
@ -47,6 +47,7 @@ import ru.dbotthepony.mc.otm.core.util.BigDecimalValueCodec
|
|||||||
import ru.dbotthepony.mc.otm.core.util.BinaryStringCodec
|
import ru.dbotthepony.mc.otm.core.util.BinaryStringCodec
|
||||||
import ru.dbotthepony.mc.otm.core.util.BooleanValueCodec
|
import ru.dbotthepony.mc.otm.core.util.BooleanValueCodec
|
||||||
import ru.dbotthepony.mc.otm.core.util.CollectionStreamCodec
|
import ru.dbotthepony.mc.otm.core.util.CollectionStreamCodec
|
||||||
|
import ru.dbotthepony.mc.otm.core.util.FloatValueCodec
|
||||||
import ru.dbotthepony.mc.otm.core.util.IStreamCodec
|
import ru.dbotthepony.mc.otm.core.util.IStreamCodec
|
||||||
import ru.dbotthepony.mc.otm.core.util.ItemStackValueCodec
|
import ru.dbotthepony.mc.otm.core.util.ItemStackValueCodec
|
||||||
import ru.dbotthepony.mc.otm.core.util.ItemValueCodec
|
import ru.dbotthepony.mc.otm.core.util.ItemValueCodec
|
||||||
@ -189,6 +190,7 @@ abstract class MatteryMenu(
|
|||||||
fun itemStackInput(allowSpectators: Boolean = false, handler: (ItemStack) -> Unit) = PlayerInput(ItemStackValueCodec, allowSpectators, handler)
|
fun itemStackInput(allowSpectators: Boolean = false, handler: (ItemStack) -> Unit) = PlayerInput(ItemStackValueCodec, allowSpectators, handler)
|
||||||
fun nullableItemInput(allowSpectators: Boolean = false, handler: (Item?) -> Unit) = PlayerInput(ItemValueCodec.nullable, allowSpectators, handler)
|
fun nullableItemInput(allowSpectators: Boolean = false, handler: (Item?) -> Unit) = PlayerInput(ItemValueCodec.nullable, allowSpectators, handler)
|
||||||
fun stringInput(allowSpectators: Boolean = false, handler: (String) -> Unit) = PlayerInput(BinaryStringCodec, allowSpectators, handler)
|
fun stringInput(allowSpectators: Boolean = false, handler: (String) -> Unit) = PlayerInput(BinaryStringCodec, allowSpectators, handler)
|
||||||
|
fun floatInput(allowSpectators: Boolean = false, handler: (Float) -> Unit) = PlayerInput(FloatValueCodec, allowSpectators, handler)
|
||||||
fun intInput(allowSpectators: Boolean = false, handler: (Int) -> Unit) = PlayerInput(VarIntValueCodec, allowSpectators, handler)
|
fun intInput(allowSpectators: Boolean = false, handler: (Int) -> Unit) = PlayerInput(VarIntValueCodec, allowSpectators, handler)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,10 +7,11 @@ import ru.dbotthepony.mc.otm.block.entity.decorative.HoloSignBlockEntity
|
|||||||
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
||||||
import ru.dbotthepony.mc.otm.menu.input.BooleanInputWithFeedback
|
import ru.dbotthepony.mc.otm.menu.input.BooleanInputWithFeedback
|
||||||
import ru.dbotthepony.mc.otm.menu.input.EnumInputWithFeedback
|
import ru.dbotthepony.mc.otm.menu.input.EnumInputWithFeedback
|
||||||
|
import ru.dbotthepony.mc.otm.menu.input.FloatInputWithFeedback
|
||||||
import ru.dbotthepony.mc.otm.menu.input.StringInputWithFeedback
|
import ru.dbotthepony.mc.otm.menu.input.StringInputWithFeedback
|
||||||
import ru.dbotthepony.mc.otm.registry.MMenus
|
import ru.dbotthepony.mc.otm.registry.MMenus
|
||||||
|
|
||||||
class HoloSignMenu @JvmOverloads constructor(
|
class HoloSignMenu(
|
||||||
containerId: Int,
|
containerId: Int,
|
||||||
inventory: Inventory,
|
inventory: Inventory,
|
||||||
tile: HoloSignBlockEntity? = null
|
tile: HoloSignBlockEntity? = null
|
||||||
@ -19,13 +20,27 @@ class HoloSignMenu @JvmOverloads constructor(
|
|||||||
val locked = BooleanInputWithFeedback(this)
|
val locked = BooleanInputWithFeedback(this)
|
||||||
val redstone = EnumInputWithFeedback(this, RedstoneSetting::class.java)
|
val redstone = EnumInputWithFeedback(this, RedstoneSetting::class.java)
|
||||||
|
|
||||||
|
val textRed = FloatInputWithFeedback(this)
|
||||||
|
val textGreen = FloatInputWithFeedback(this)
|
||||||
|
val textBlue = FloatInputWithFeedback(this)
|
||||||
|
val textAlpha = FloatInputWithFeedback(this)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
text.filter { it.isCreative || !locked.value }
|
text.filter { it.isCreative || !locked.value }
|
||||||
redstone.filter { it.isCreative || !locked.value }
|
redstone.filter { it.isCreative || !locked.value }
|
||||||
locked.filter { it.isCreative }
|
locked.filter { it.isCreative }
|
||||||
|
|
||||||
|
textRed.filter { it.isCreative || !locked.value }
|
||||||
|
textGreen.filter { it.isCreative || !locked.value }
|
||||||
|
textBlue.filter { it.isCreative || !locked.value }
|
||||||
|
textAlpha.filter { it.isCreative || !locked.value }
|
||||||
|
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
text.withConsumer { if (tile.isLocked) tile.signText = it else tile.signText = HoloSignBlockEntity.truncate(it) }.withSupplier(tile::signText)
|
text.withConsumer { if (tile.isLocked) tile.signText = it else tile.signText = HoloSignBlockEntity.truncate(it) }.withSupplier(tile::signText)
|
||||||
|
textRed.withConsumer { tile.textRed = it.coerceIn(0f, 1f) }.withSupplier(tile::textRed)
|
||||||
|
textGreen.withConsumer { tile.textGreen = it.coerceIn(0f, 1f) }.withSupplier(tile::textGreen)
|
||||||
|
textBlue.withConsumer { tile.textBlue = it.coerceIn(0f, 1f) }.withSupplier(tile::textBlue)
|
||||||
|
textAlpha.withConsumer { tile.textAlpha = it.coerceIn(0f, 1f) }.withSupplier(tile::textAlpha)
|
||||||
locked.with(tile::isLocked)
|
locked.with(tile::isLocked)
|
||||||
redstone.with(tile.redstoneControl::redstoneSetting)
|
redstone.with(tile.redstoneControl::redstoneSetting)
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.menu.input
|
||||||
|
|
||||||
|
import ru.dbotthepony.mc.otm.core.GetterSetter
|
||||||
|
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
||||||
|
import kotlin.reflect.KMutableProperty0
|
||||||
|
|
||||||
|
class FloatInputWithFeedback(menu: MatteryMenu) : AbstractPlayerInputWithFeedback<Float>() {
|
||||||
|
override val input = menu.floatInput { consumer?.invoke(it) }
|
||||||
|
override val field = menu.mSynchronizer.computedFloat { supplier?.invoke() ?: 0f }
|
||||||
|
|
||||||
|
constructor(menu: MatteryMenu, state: KMutableProperty0<Float>) : this(menu) {
|
||||||
|
with(state)
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(menu: MatteryMenu, state: GetterSetter<Float>) : this(menu) {
|
||||||
|
with(state)
|
||||||
|
}
|
||||||
|
}
|
@ -14,6 +14,7 @@ import ru.dbotthepony.mc.otm.item.EssenceServoItem
|
|||||||
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
||||||
import ru.dbotthepony.mc.otm.menu.MatterySlot
|
import ru.dbotthepony.mc.otm.menu.MatterySlot
|
||||||
import ru.dbotthepony.mc.otm.menu.input.EnumInputWithFeedback
|
import ru.dbotthepony.mc.otm.menu.input.EnumInputWithFeedback
|
||||||
|
import ru.dbotthepony.mc.otm.menu.input.FluidConfigPlayerInput
|
||||||
import ru.dbotthepony.mc.otm.menu.input.ItemConfigPlayerInput
|
import ru.dbotthepony.mc.otm.menu.input.ItemConfigPlayerInput
|
||||||
import ru.dbotthepony.mc.otm.registry.MItems
|
import ru.dbotthepony.mc.otm.registry.MItems
|
||||||
import ru.dbotthepony.mc.otm.registry.MMenus
|
import ru.dbotthepony.mc.otm.registry.MMenus
|
||||||
@ -26,6 +27,7 @@ class EssenceStorageMenu @JvmOverloads constructor(
|
|||||||
val experienceStored by mSynchronizer.ComputedLongField(getter = { tile?.experienceStored ?: 0L }).property
|
val experienceStored by mSynchronizer.ComputedLongField(getter = { tile?.experienceStored ?: 0L }).property
|
||||||
val redstoneConfig = EnumInputWithFeedback<RedstoneSetting>(this)
|
val redstoneConfig = EnumInputWithFeedback<RedstoneSetting>(this)
|
||||||
val itemConfig = ItemConfigPlayerInput(this, tile?.itemConfig)
|
val itemConfig = ItemConfigPlayerInput(this, tile?.itemConfig)
|
||||||
|
val fluidConfig = FluidConfigPlayerInput(this, tile?.fluidConfig)
|
||||||
|
|
||||||
val capsuleSlot = object : MatterySlot(tile?.capsuleContainer ?: SimpleContainer(1), 0) {
|
val capsuleSlot = object : MatterySlot(tile?.capsuleContainer ?: SimpleContainer(1), 0) {
|
||||||
override fun mayPlace(itemStack: ItemStack): Boolean {
|
override fun mayPlace(itemStack: ItemStack): Boolean {
|
||||||
|
@ -3,7 +3,10 @@ package ru.dbotthepony.mc.otm.menu.tech
|
|||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
import net.minecraft.world.entity.player.Inventory
|
import net.minecraft.world.entity.player.Inventory
|
||||||
import net.minecraft.world.inventory.MenuType
|
import net.minecraft.world.inventory.MenuType
|
||||||
|
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.PoweredFurnaceBlockEntity
|
||||||
|
import ru.dbotthepony.mc.otm.block.entity.tech.PoweredSmokerBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.core.immutableList
|
import ru.dbotthepony.mc.otm.core.immutableList
|
||||||
import ru.dbotthepony.mc.otm.menu.OutputSlot
|
import ru.dbotthepony.mc.otm.menu.OutputSlot
|
||||||
import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu
|
import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu
|
||||||
@ -20,7 +23,7 @@ class PoweredFurnaceMenu(
|
|||||||
type: MenuType<PoweredFurnaceMenu>,
|
type: MenuType<PoweredFurnaceMenu>,
|
||||||
containerID: Int,
|
containerID: Int,
|
||||||
inventory: Inventory,
|
inventory: Inventory,
|
||||||
tile: PoweredFurnaceBlockEntity? = null
|
tile: AbstractPoweredFurnaceBlockEntity<*, *>? = null
|
||||||
) : MatteryPoweredMenu(type, containerID, inventory, tile) {
|
) : MatteryPoweredMenu(type, containerID, inventory, tile) {
|
||||||
val inputSlots = makeSlots(tile?.inputs, 2, ::MatterySlot)
|
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 outputSlots = makeSlots(tile?.outputs, 2) { c, s -> OutputSlot(c, s) { tile?.experience?.popExperience(player as ServerPlayer) } }
|
||||||
@ -53,7 +56,7 @@ class PoweredFurnaceMenu(
|
|||||||
fun blasting(
|
fun blasting(
|
||||||
containerID: Int,
|
containerID: Int,
|
||||||
inventory: Inventory,
|
inventory: Inventory,
|
||||||
tile: PoweredFurnaceBlockEntity? = null
|
tile: PoweredBlastFurnaceBlockEntity? = null
|
||||||
) : PoweredFurnaceMenu {
|
) : PoweredFurnaceMenu {
|
||||||
return PoweredFurnaceMenu(MMenus.POWERED_BLAST_FURNACE, containerID, inventory, tile)
|
return PoweredFurnaceMenu(MMenus.POWERED_BLAST_FURNACE, containerID, inventory, tile)
|
||||||
}
|
}
|
||||||
@ -61,7 +64,7 @@ class PoweredFurnaceMenu(
|
|||||||
fun smoking(
|
fun smoking(
|
||||||
containerID: Int,
|
containerID: Int,
|
||||||
inventory: Inventory,
|
inventory: Inventory,
|
||||||
tile: PoweredFurnaceBlockEntity? = null
|
tile: PoweredSmokerBlockEntity? = null
|
||||||
) : PoweredFurnaceMenu {
|
) : PoweredFurnaceMenu {
|
||||||
return PoweredFurnaceMenu(MMenus.POWERED_SMOKER, containerID, inventory, tile)
|
return PoweredFurnaceMenu(MMenus.POWERED_SMOKER, containerID, inventory, tile)
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ class MicrowaveRecipe(
|
|||||||
experience: FloatProvider = ConstantFloat.ZERO
|
experience: FloatProvider = ConstantFloat.ZERO
|
||||||
) : MatteryCookingRecipe(id, input, output, count, workTime, experience) {
|
) : MatteryCookingRecipe(id, input, output, count, workTime, experience) {
|
||||||
override fun getType(): RecipeType<*> = MRecipes.MICROWAVE
|
override fun getType(): RecipeType<*> = MRecipes.MICROWAVE
|
||||||
override fun getToastSymbol(): ItemStack = ItemStack(MItems.POWERED_SMOKER)
|
override fun getToastSymbol(): ItemStack = ItemStack(MItems.POWERED_SMOKER[null]!!)
|
||||||
override fun getSerializer(): RecipeSerializer<*> = SERIALIZER
|
override fun getSerializer(): RecipeSerializer<*> = SERIALIZER
|
||||||
override fun toFinished(): FinishedRecipe = SERIALIZER.toFinished(this)
|
override fun toFinished(): FinishedRecipe = SERIALIZER.toFinished(this)
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ class PlatePressRecipe(
|
|||||||
override fun getType(): RecipeType<PlatePressRecipe> = MRecipes.PLATE_PRESS
|
override fun getType(): RecipeType<PlatePressRecipe> = MRecipes.PLATE_PRESS
|
||||||
|
|
||||||
override fun getToastSymbol(): ItemStack {
|
override fun getToastSymbol(): ItemStack {
|
||||||
return ItemStack(MItems.PLATE_PRESS)
|
return ItemStack(MItems.PLATE_PRESS[null]!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toFinished() = SERIALIZER.toFinished(this)
|
fun toFinished() = SERIALIZER.toFinished(this)
|
||||||
|
@ -1,56 +1,25 @@
|
|||||||
package ru.dbotthepony.mc.otm.registry
|
package ru.dbotthepony.mc.otm.registry
|
||||||
|
|
||||||
import com.mojang.serialization.Lifecycle
|
|
||||||
import net.minecraft.core.Holder
|
|
||||||
import net.minecraft.core.Registry
|
|
||||||
import net.minecraft.core.WritableRegistry
|
|
||||||
import net.minecraft.resources.ResourceKey
|
|
||||||
import net.minecraft.resources.ResourceLocation
|
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraftforge.registries.DeferredRegister
|
import net.minecraftforge.registries.DeferredRegister
|
||||||
import net.minecraftforge.registries.RegistryObject
|
import net.minecraftforge.registries.RegistryObject
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
|
||||||
import ru.dbotthepony.mc.otm.core.collect.SupplierMap
|
import ru.dbotthepony.mc.otm.core.collect.SupplierMap
|
||||||
|
import java.util.function.Supplier
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
operator fun <T : Any> RegistryObject<T>.getValue(thisRef: Any, property: KProperty<*>): T {
|
operator fun <T : Any> RegistryObject<T>.getValue(thisRef: Any, property: KProperty<*>): T {
|
||||||
return get()
|
return get()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <T> DeferredRegister<T>.doColored(prefix: String, factory: (color: DyeColor, name: String) -> T): MutableCollection<Pair<DyeColor, () -> T>> {
|
internal fun <T, R : T> DeferredRegister<T>.colored(prefix: String, factory: (color: DyeColor, name: String) -> R): Map<DyeColor, R> {
|
||||||
return mutableListOf(
|
return SupplierMap(MRegistry.DYE_ORDER.map { it to register(prefix + "_" + it.name.lowercase()) { factory.invoke(it, prefix + "_" + it.name.lowercase()) } })
|
||||||
DyeColor.BLACK to register(prefix + "_black") { factory.invoke(DyeColor.BLACK, prefix + "_black") }::get,
|
|
||||||
DyeColor.BLUE to register(prefix + "_blue") { factory.invoke(DyeColor.BLUE, prefix + "_blue") }::get,
|
|
||||||
DyeColor.BROWN to register(prefix + "_brown") { factory.invoke(DyeColor.BROWN, prefix + "_brown") }::get,
|
|
||||||
DyeColor.CYAN to register(prefix + "_cyan") { factory.invoke(DyeColor.CYAN, prefix + "_cyan") }::get,
|
|
||||||
DyeColor.GRAY to register(prefix + "_gray") { factory.invoke(DyeColor.GRAY, prefix + "_gray") }::get,
|
|
||||||
DyeColor.GREEN to register(prefix + "_green") { factory.invoke(DyeColor.GREEN, prefix + "_green") }::get,
|
|
||||||
DyeColor.LIGHT_BLUE to register(prefix + "_light_blue") { factory.invoke(DyeColor.LIGHT_BLUE, prefix + "_light_blue") }::get,
|
|
||||||
DyeColor.LIGHT_GRAY to register(prefix + "_light_gray") { factory.invoke(DyeColor.LIGHT_GRAY, prefix + "_light_gray") }::get,
|
|
||||||
DyeColor.LIME to register(prefix + "_lime") { factory.invoke(DyeColor.LIME, prefix + "_lime") }::get,
|
|
||||||
DyeColor.MAGENTA to register(prefix + "_magenta") { factory.invoke(DyeColor.MAGENTA, prefix + "_magenta") }::get,
|
|
||||||
DyeColor.ORANGE to register(prefix + "_orange") { factory.invoke(DyeColor.ORANGE, prefix + "_orange") }::get,
|
|
||||||
DyeColor.PINK to register(prefix + "_pink") { factory.invoke(DyeColor.PINK, prefix + "_pink") }::get,
|
|
||||||
DyeColor.PURPLE to register(prefix + "_purple") { factory.invoke(DyeColor.PURPLE, prefix + "_purple") }::get,
|
|
||||||
DyeColor.RED to register(prefix + "_red") { factory.invoke(DyeColor.RED, prefix + "_red") }::get,
|
|
||||||
DyeColor.WHITE to register(prefix + "_white") { factory.invoke(DyeColor.WHITE, prefix + "_white") }::get,
|
|
||||||
DyeColor.YELLOW to register(prefix + "_yellow") { factory.invoke(DyeColor.YELLOW, prefix + "_yellow") }::get,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun <T> DeferredRegister<T>.colored(prefix: String, factory: (color: DyeColor, name: String) -> T): Map<DyeColor, T> {
|
internal fun <T, R : T> DeferredRegister<T>.coloredWithBase(prefix: String, factory: (color: DyeColor?, name: String) -> R): Map<DyeColor?, R> {
|
||||||
return SupplierMap(doColored(prefix, factory))
|
val values = ArrayList<Pair<DyeColor?, Supplier<R>>>()
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("unchecked_cast")
|
values.add(null to register(prefix) { factory.invoke(null, prefix) })
|
||||||
internal fun <T> DeferredRegister<T>.allColored(prefix: String, factory: (color: DyeColor?, name: String) -> T): Map<DyeColor?, T> {
|
MRegistry.DYE_ORDER.forEach { values.add(it to register(prefix + "_" + it.name.lowercase()) { factory.invoke(it, prefix + "_" + it.name.lowercase()) }) }
|
||||||
return SupplierMap(doColored(prefix, factory).also { (it as MutableCollection<Pair<DyeColor?, () -> T>>).add((null as DyeColor?) to register(prefix) { factory.invoke(null, prefix) }::get) })
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun <T> Registry<T>.register(key: String, value: T): Holder<T> {
|
return SupplierMap(values)
|
||||||
return this.register(ResourceLocation(OverdriveThatMatters.MOD_ID, key), value)
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun <T> Registry<T>.register(key: ResourceLocation, value: T): Holder<T> {
|
|
||||||
return (this as WritableRegistry<T>).register(ResourceKey.create(key(), key), value, Lifecycle.stable())
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ object MBlockColors {
|
|||||||
private const val DEFAULT_WATER_TINT: Int = 0x3F76E4
|
private const val DEFAULT_WATER_TINT: Int = 0x3F76E4
|
||||||
|
|
||||||
private fun registerBlockColors(event: RegisterColorHandlersEvent.Block) {
|
private fun registerBlockColors(event: RegisterColorHandlersEvent.Block) {
|
||||||
|
for (it in MBlocks.COBBLESTONE_GENERATOR.values) {
|
||||||
event.register({ state: BlockState, light: BlockAndTintGetter?, pos: BlockPos?, index: Int ->
|
event.register({ state: BlockState, light: BlockAndTintGetter?, pos: BlockPos?, index: Int ->
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (light == null || pos == null)
|
if (light == null || pos == null)
|
||||||
@ -19,13 +20,16 @@ object MBlockColors {
|
|||||||
else
|
else
|
||||||
BiomeColors.getAverageWaterColor(light, pos)
|
BiomeColors.getAverageWaterColor(light, pos)
|
||||||
} else -1
|
} else -1
|
||||||
}, MBlocks.COBBLESTONE_GENERATOR)
|
}, it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun registerItemColors(event: RegisterColorHandlersEvent.Item) {
|
private fun registerItemColors(event: RegisterColorHandlersEvent.Item) {
|
||||||
|
for (it in MBlocks.COBBLESTONE_GENERATOR.values) {
|
||||||
event.register({ stack: ItemStack, index: Int ->
|
event.register({ stack: ItemStack, index: Int ->
|
||||||
if (index == 0) DEFAULT_WATER_TINT else -1
|
if (index == 0) DEFAULT_WATER_TINT else -1
|
||||||
}, MBlocks.COBBLESTONE_GENERATOR)
|
}, it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun register(bus: IEventBus) {
|
internal fun register(bus: IEventBus) {
|
||||||
|
@ -31,6 +31,7 @@ import ru.dbotthepony.mc.otm.block.entity.tech.GravitationStabilizerBlockEntity
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.tech.PlatePressBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.tech.PlatePressBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.client.render.blockentity.*
|
import ru.dbotthepony.mc.otm.client.render.blockentity.*
|
||||||
import ru.dbotthepony.mc.otm.config.CablesConfig
|
import ru.dbotthepony.mc.otm.config.CablesConfig
|
||||||
|
import ru.dbotthepony.mc.otm.core.asSupplierArray
|
||||||
import ru.dbotthepony.mc.otm.core.collect.SupplierMap
|
import ru.dbotthepony.mc.otm.core.collect.SupplierMap
|
||||||
import ru.dbotthepony.mc.otm.core.getValue
|
import ru.dbotthepony.mc.otm.core.getValue
|
||||||
import java.util.function.Supplier
|
import java.util.function.Supplier
|
||||||
@ -43,32 +44,32 @@ object MBlockEntities {
|
|||||||
return registry.register(name) { BlockEntityType.Builder.of(factory, *blocks.map { it.get() }.toTypedArray()).build(null) }
|
return registry.register(name) { BlockEntityType.Builder.of(factory, *blocks.map { it.get() }.toTypedArray()).build(null) }
|
||||||
}
|
}
|
||||||
|
|
||||||
val ANDROID_STATION by register(MNames.ANDROID_STATION, ::AndroidStationBlockEntity, MBlocks::ANDROID_STATION)
|
val ANDROID_STATION by register(MNames.ANDROID_STATION, ::AndroidStationBlockEntity, *MBlocks.ANDROID_STATION.asSupplierArray())
|
||||||
val BATTERY_BANK by register(MNames.BATTERY_BANK, ::BatteryBankBlockEntity, MBlocks::BATTERY_BANK)
|
val BATTERY_BANK by register(MNames.BATTERY_BANK, ::BatteryBankBlockEntity, *MBlocks.BATTERY_BANK.asSupplierArray())
|
||||||
val MATTER_DECOMPOSER by register(MNames.MATTER_DECOMPOSER, ::MatterDecomposerBlockEntity, MBlocks::MATTER_DECOMPOSER)
|
val MATTER_DECOMPOSER by register(MNames.MATTER_DECOMPOSER, ::MatterDecomposerBlockEntity, *MBlocks.MATTER_DECOMPOSER.asSupplierArray())
|
||||||
val MATTER_CAPACITOR_BANK by register(MNames.MATTER_CAPACITOR_BANK, ::MatterCapacitorBankBlockEntity, MBlocks::MATTER_CAPACITOR_BANK)
|
val MATTER_CAPACITOR_BANK by register(MNames.MATTER_CAPACITOR_BANK, ::MatterCapacitorBankBlockEntity, *MBlocks.MATTER_CAPACITOR_BANK.asSupplierArray())
|
||||||
val MATTER_CABLE by register(MNames.MATTER_CABLE, ::MatterCableBlockEntity, MBlocks::MATTER_CABLE)
|
val MATTER_CABLE by register(MNames.MATTER_CABLE, ::MatterCableBlockEntity, MBlocks::MATTER_CABLE)
|
||||||
val STORAGE_CABLE by register(MNames.STORAGE_CABLE, ::StorageCableBlockEntity, MBlocks::STORAGE_CABLE)
|
val STORAGE_CABLE by register(MNames.STORAGE_CABLE, ::StorageCableBlockEntity, MBlocks::STORAGE_CABLE)
|
||||||
val PATTERN_STORAGE by register(MNames.PATTERN_STORAGE, ::PatternStorageBlockEntity, MBlocks::PATTERN_STORAGE)
|
val PATTERN_STORAGE by register(MNames.PATTERN_STORAGE, ::PatternStorageBlockEntity, MBlocks::PATTERN_STORAGE)
|
||||||
val MATTER_SCANNER by register(MNames.MATTER_SCANNER, ::MatterScannerBlockEntity, MBlocks::MATTER_SCANNER)
|
val MATTER_SCANNER by register(MNames.MATTER_SCANNER, ::MatterScannerBlockEntity, *MBlocks.MATTER_SCANNER.asSupplierArray())
|
||||||
val MATTER_PANEL by register(MNames.MATTER_PANEL, ::MatterPanelBlockEntity, MBlocks::MATTER_PANEL)
|
val MATTER_PANEL by register(MNames.MATTER_PANEL, ::MatterPanelBlockEntity, MBlocks::MATTER_PANEL)
|
||||||
val MATTER_REPLICATOR by register(MNames.MATTER_REPLICATOR, ::MatterReplicatorBlockEntity, MBlocks::MATTER_REPLICATOR)
|
val MATTER_REPLICATOR by register(MNames.MATTER_REPLICATOR, ::MatterReplicatorBlockEntity, *MBlocks.MATTER_REPLICATOR.asSupplierArray())
|
||||||
val MATTER_BOTTLER by register(MNames.MATTER_BOTTLER, ::MatterBottlerBlockEntity, MBlocks::MATTER_BOTTLER)
|
val MATTER_BOTTLER by register(MNames.MATTER_BOTTLER, ::MatterBottlerBlockEntity, *MBlocks.MATTER_BOTTLER.asSupplierArray())
|
||||||
val DRIVE_VIEWER by register(MNames.DRIVE_VIEWER, ::DriveViewerBlockEntity, MBlocks::DRIVE_VIEWER)
|
val DRIVE_VIEWER by register(MNames.DRIVE_VIEWER, ::DriveViewerBlockEntity, MBlocks::DRIVE_VIEWER)
|
||||||
val BLACK_HOLE by register(MNames.BLACK_HOLE, ::BlackHoleBlockEntity, MBlocks::BLACK_HOLE)
|
val BLACK_HOLE by register(MNames.BLACK_HOLE, ::BlackHoleBlockEntity, MBlocks::BLACK_HOLE)
|
||||||
val CARGO_CRATE by registry.register(MNames.CARGO_CRATE) { BlockEntityType.Builder.of(::CargoCrateBlockEntity, *MRegistry.CARGO_CRATES.blocks.values.toTypedArray()).build(null) }
|
val CARGO_CRATE by register(MNames.CARGO_CRATE, ::CargoCrateBlockEntity, *MRegistry.CARGO_CRATES.blocks.asSupplierArray())
|
||||||
val DRIVE_RACK by register(MNames.DRIVE_RACK, ::DriveRackBlockEntity, MBlocks::DRIVE_RACK)
|
val DRIVE_RACK by register(MNames.DRIVE_RACK, ::DriveRackBlockEntity, MBlocks::DRIVE_RACK)
|
||||||
val ITEM_MONITOR by register(MNames.ITEM_MONITOR, ::ItemMonitorBlockEntity, MBlocks::ITEM_MONITOR)
|
val ITEM_MONITOR by register(MNames.ITEM_MONITOR, ::ItemMonitorBlockEntity, *MBlocks.ITEM_MONITOR.asSupplierArray())
|
||||||
val ENERGY_COUNTER by register(MNames.ENERGY_COUNTER, ::EnergyCounterBlockEntity, MBlocks::ENERGY_COUNTER)
|
val ENERGY_COUNTER by register(MNames.ENERGY_COUNTER, ::EnergyCounterBlockEntity, MBlocks::ENERGY_COUNTER)
|
||||||
val CHEMICAL_GENERATOR by register(MNames.CHEMICAL_GENERATOR, ::ChemicalGeneratorBlockEntity, MBlocks::CHEMICAL_GENERATOR)
|
val CHEMICAL_GENERATOR by register(MNames.CHEMICAL_GENERATOR, ::ChemicalGeneratorBlockEntity, MBlocks::CHEMICAL_GENERATOR)
|
||||||
val PLATE_PRESS by register(MNames.PLATE_PRESS, ::PlatePressBlockEntity, MBlocks::PLATE_PRESS)
|
val PLATE_PRESS by register(MNames.PLATE_PRESS, ::PlatePressBlockEntity, *MBlocks.PLATE_PRESS.asSupplierArray())
|
||||||
val TWIN_PLATE_PRESS by register(MNames.TWIN_PLATE_PRESS, { a, b -> PlatePressBlockEntity(a, b, true) }, MBlocks::TWIN_PLATE_PRESS)
|
val TWIN_PLATE_PRESS by register(MNames.TWIN_PLATE_PRESS, { a, b -> PlatePressBlockEntity(a, b, true) }, *MBlocks.TWIN_PLATE_PRESS.asSupplierArray())
|
||||||
val GRAVITATION_STABILIZER by register(MNames.GRAVITATION_STABILIZER, ::GravitationStabilizerBlockEntity, MBlocks::GRAVITATION_STABILIZER)
|
val GRAVITATION_STABILIZER by register(MNames.GRAVITATION_STABILIZER, ::GravitationStabilizerBlockEntity, MBlocks::GRAVITATION_STABILIZER)
|
||||||
val MATTER_RECYCLER by register(MNames.MATTER_RECYCLER, ::MatterRecyclerBlockEntity, MBlocks::MATTER_RECYCLER)
|
val MATTER_RECYCLER by register(MNames.MATTER_RECYCLER, ::MatterRecyclerBlockEntity, *MBlocks.MATTER_RECYCLER.asSupplierArray())
|
||||||
val ENERGY_SERVO by register(MNames.ENERGY_SERVO, ::EnergyServoBlockEntity, MBlocks::ENERGY_SERVO)
|
val ENERGY_SERVO by register(MNames.ENERGY_SERVO, ::EnergyServoBlockEntity, MBlocks::ENERGY_SERVO)
|
||||||
val COBBLESTONE_GENERATOR by register(MNames.COBBLESTONE_GENERATOR, ::CobblerBlockEntity, MBlocks::COBBLESTONE_GENERATOR)
|
val COBBLESTONE_GENERATOR by register(MNames.COBBLESTONE_GENERATOR, ::CobblerBlockEntity, *MBlocks.COBBLESTONE_GENERATOR.asSupplierArray())
|
||||||
val ESSENCE_STORAGE by register(MNames.ESSENCE_STORAGE, ::EssenceStorageBlockEntity, MBlocks::ESSENCE_STORAGE)
|
val ESSENCE_STORAGE by register(MNames.ESSENCE_STORAGE, ::EssenceStorageBlockEntity, *MBlocks.ESSENCE_STORAGE.asSupplierArray())
|
||||||
val MATTER_RECONSTRUCTOR by register(MNames.MATTER_RECONSTRUCTOR, ::MatterReconstructorBlockEntity, MBlocks::MATTER_RECONSTRUCTOR)
|
val MATTER_RECONSTRUCTOR by register(MNames.MATTER_RECONSTRUCTOR, ::MatterReconstructorBlockEntity, *MBlocks.MATTER_RECONSTRUCTOR.asSupplierArray())
|
||||||
val FLUID_TANK by register(MNames.FLUID_TANK, ::FluidTankBlockEntity, MBlocks::FLUID_TANK)
|
val FLUID_TANK by register(MNames.FLUID_TANK, ::FluidTankBlockEntity, MBlocks::FLUID_TANK)
|
||||||
val ANDROID_CHARGER by register(MNames.ANDROID_CHARGER, ::AndroidChargerBlockEntity, MBlocks::ANDROID_CHARGER)
|
val ANDROID_CHARGER by register(MNames.ANDROID_CHARGER, ::AndroidChargerBlockEntity, MBlocks::ANDROID_CHARGER)
|
||||||
val ANDROID_CHARGER_MIDDLE by register(MNames.ANDROID_CHARGER + "_middle", ::AndroidChargerMiddleBlockEntity, MBlocks::ANDROID_CHARGER)
|
val ANDROID_CHARGER_MIDDLE by register(MNames.ANDROID_CHARGER + "_middle", ::AndroidChargerMiddleBlockEntity, MBlocks::ANDROID_CHARGER)
|
||||||
@ -78,16 +79,16 @@ object MBlockEntities {
|
|||||||
val PAINTER by register(MNames.PAINTER, ::PainterBlockEntity, MBlocks::PAINTER)
|
val PAINTER by register(MNames.PAINTER, ::PainterBlockEntity, MBlocks::PAINTER)
|
||||||
val MATTER_ENTANGLER by register(MNames.MATTER_ENTANGLER, ::MatterEntanglerBlockEntity, MBlocks::MATTER_ENTANGLER)
|
val MATTER_ENTANGLER by register(MNames.MATTER_ENTANGLER, ::MatterEntanglerBlockEntity, MBlocks::MATTER_ENTANGLER)
|
||||||
|
|
||||||
|
val POWERED_FURNACE by register(MNames.POWERED_FURNACE, ::PoweredFurnaceBlockEntity, *MBlocks.POWERED_FURNACE.asSupplierArray())
|
||||||
|
val POWERED_BLAST_FURNACE by register(MNames.POWERED_BLAST_FURNACE, ::PoweredBlastFurnaceBlockEntity, *MBlocks.POWERED_BLAST_FURNACE.asSupplierArray())
|
||||||
|
val POWERED_SMOKER by register(MNames.POWERED_SMOKER, ::PoweredSmokerBlockEntity, *MBlocks.POWERED_SMOKER.asSupplierArray())
|
||||||
|
|
||||||
val ENERGY_CABLES: Map<CablesConfig.E, BlockEntityType<*>> = SupplierMap(CablesConfig.E.entries.map { conf ->
|
val ENERGY_CABLES: Map<CablesConfig.E, BlockEntityType<*>> = SupplierMap(CablesConfig.E.entries.map { conf ->
|
||||||
var selfFeed: Supplier<BlockEntityType<*>> = Supplier { TODO() }
|
var selfFeed: Supplier<BlockEntityType<*>> = Supplier { TODO() }
|
||||||
selfFeed = register("${conf.name.lowercase()}_energy_cable", { a, b -> SimpleEnergyCableBlockEntity(selfFeed.get(), a, b, conf) }) as Supplier<BlockEntityType<*>>
|
selfFeed = register("${conf.name.lowercase()}_energy_cable", { a, b -> SimpleEnergyCableBlockEntity(selfFeed.get(), a, b, conf) }) as Supplier<BlockEntityType<*>>
|
||||||
conf to selfFeed::get
|
conf to selfFeed
|
||||||
})
|
})
|
||||||
|
|
||||||
val POWERED_FURNACE: BlockEntityType<PoweredFurnaceBlockEntity> by registry.register(MNames.POWERED_FURNACE) { BlockEntityType.Builder.of({ a, b -> MBlocks.POWERED_FURNACE.newBlockEntity(a, b) }, MBlocks.POWERED_FURNACE).build(null) }
|
|
||||||
val POWERED_BLAST_FURNACE: BlockEntityType<PoweredFurnaceBlockEntity> by registry.register(MNames.POWERED_BLAST_FURNACE) { BlockEntityType.Builder.of({ a, b -> MBlocks.POWERED_BLAST_FURNACE.newBlockEntity(a, b) }, MBlocks.POWERED_BLAST_FURNACE).build(null) }
|
|
||||||
val POWERED_SMOKER: BlockEntityType<PoweredFurnaceBlockEntity> by registry.register(MNames.POWERED_SMOKER) { BlockEntityType.Builder.of({ a, b -> MBlocks.POWERED_SMOKER.newBlockEntity(a, b) }, MBlocks.POWERED_SMOKER).build(null) }
|
|
||||||
|
|
||||||
val STORAGE_BUS: BlockEntityType<StorageBusBlockEntity> by registry.register(MNames.STORAGE_BUS) { BlockEntityType.Builder.of(::StorageBusBlockEntity, MBlocks.STORAGE_BUS).build(null) }
|
val STORAGE_BUS: BlockEntityType<StorageBusBlockEntity> by registry.register(MNames.STORAGE_BUS) { BlockEntityType.Builder.of(::StorageBusBlockEntity, MBlocks.STORAGE_BUS).build(null) }
|
||||||
val STORAGE_IMPORTER: BlockEntityType<StorageImporterBlockEntity> by registry.register(MNames.STORAGE_IMPORTER) { BlockEntityType.Builder.of(::StorageImporterBlockEntity, MBlocks.STORAGE_IMPORTER).build(null) }
|
val STORAGE_IMPORTER: BlockEntityType<StorageImporterBlockEntity> by registry.register(MNames.STORAGE_IMPORTER) { BlockEntityType.Builder.of(::StorageImporterBlockEntity, MBlocks.STORAGE_IMPORTER).build(null) }
|
||||||
val STORAGE_EXPORTER: BlockEntityType<StorageExporterBlockEntity> by registry.register(MNames.STORAGE_EXPORTER) { BlockEntityType.Builder.of(::StorageExporterBlockEntity, MBlocks.STORAGE_EXPORTER).build(null) }
|
val STORAGE_EXPORTER: BlockEntityType<StorageExporterBlockEntity> by registry.register(MNames.STORAGE_EXPORTER) { BlockEntityType.Builder.of(::StorageExporterBlockEntity, MBlocks.STORAGE_EXPORTER).build(null) }
|
||||||
@ -103,7 +104,6 @@ object MBlockEntities {
|
|||||||
bus.addListener(this::registerClient)
|
bus.addListener(this::registerClient)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("unchecked_cast")
|
|
||||||
private fun registerClient(event: FMLClientSetupEvent) {
|
private fun registerClient(event: FMLClientSetupEvent) {
|
||||||
event.enqueueWork {
|
event.enqueueWork {
|
||||||
BlockEntityRenderers.register(BLACK_HOLE, ::BlackHoleRenderer)
|
BlockEntityRenderers.register(BLACK_HOLE, ::BlackHoleRenderer)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user