æugh, datagen
This commit is contained in:
parent
24d673b5ac
commit
6714cbd479
105
.gitignore
vendored
105
.gitignore
vendored
@ -29,108 +29,3 @@ logs/
|
|||||||
|
|
||||||
# Files from Forge MDK
|
# Files from Forge MDK
|
||||||
forge*changelog.txt
|
forge*changelog.txt
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/pattern/pattern_storage_pattern0.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/pattern/pattern_storage_pattern1.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/pattern/pattern_storage_pattern2.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/pattern/pattern_storage_pattern3.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/pattern/pattern_storage_pattern4.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/pattern/pattern_storage_pattern5.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/pattern/pattern_storage_pattern6.json
|
|
||||||
/src/main/java/ru/dbotthepony/mc/otm/shapes/BlockShapes.java
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/pattern_storage.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/matter_replicator.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/matter_scanner.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/android_station.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/battery_bank.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/matter_capacitor_bank.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/matter_decomposer.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/matter_panel.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/matter_replicator.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/matter_scanner.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/pattern_storage.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/matter_decomposer.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/battery_front0.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/battery_front1.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/battery_front2.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/battery_front3.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/battery_front4.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/matter_capacitor0.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/matter_capacitor1.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/matter_capacitor10.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/matter_capacitor11.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/matter_capacitor2.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/matter_capacitor3.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/matter_capacitor4.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/matter_capacitor5.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/matter_capacitor6.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/matter_capacitor7.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/matter_capacitor8.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/matter_capacitor9.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/battery_bank.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/matter_capacitor_bank.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/battery_back0.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/battery_back1.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/battery_back2.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/battery_back3.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/battery/battery_back4.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/drive_viewer.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/matter_bottler.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/matter_bottler.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/carbon_fibre_block.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/crate_black.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/crate_blue.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/crate_green.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/crate_pink.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/crate_purple.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/crate_red.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/crate_yellow.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/matter_cable.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/tritanium_block.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/tritanium_striped_block.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/carbon_fibre_block.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/crate_black.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/crate_blue.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/crate_green.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/crate_pink.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/crate_purple.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/crate_red.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/crate_yellow.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/tritanium_block.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/tritanium_striped_block.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/carbon_fibre_block.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/crate_black.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/crate_blue.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/crate_green.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/crate_pink.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/crate_purple.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/crate_red.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/crate_yellow.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/tritanium_block.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/black_hole.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/block/black_hole.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/black_hole.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/carbon_fibre_block.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/crate_black.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/crate_blue.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/crate_green.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/crate_pink.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/crate_purple.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/crate_red.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/crate_yellow.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/tritanium_block.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/tritanium_striped_block.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/drive_viewer.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/advanced_control_circuit.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/basic_control_circuit.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/circuit_plating.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/copper_wiring.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/electric_parts.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/energy_bus.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/gold_wiring.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/iron_plate.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/matter_io_port.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/matter_transform_matrix.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/tritanium_ingot.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/models/item/tritanium_plate.json
|
|
||||||
/src/main/resources/assets/overdrive_that_matters/blockstates/cargo_crate.json
|
|
||||||
/src/main/resources/data/overdrive_that_matters/loot_tables/blocks/cargo_crate.json
|
|
||||||
|
@ -44,11 +44,6 @@ test {
|
|||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
|
||||||
//exec {
|
|
||||||
// executable 'node'
|
|
||||||
// args 'shapenator.js'
|
|
||||||
//}
|
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
data {
|
data {
|
||||||
compileClasspath += main.output
|
compileClasspath += main.output
|
||||||
|
634
shapenator.js
634
shapenator.js
@ -1,634 +0,0 @@
|
|||||||
|
|
||||||
const models = [
|
|
||||||
'android_station',
|
|
||||||
'battery_bank',
|
|
||||||
'black_hole',
|
|
||||||
['matter_scanner', 'matter_scanner_working'],
|
|
||||||
'pattern_storage',
|
|
||||||
['matter_replicator', 'matter_replicator_working'],
|
|
||||||
// 'matter_panel',
|
|
||||||
['matter_decomposer', 'matter_decomposer_working'],
|
|
||||||
|
|
||||||
['chemical_generator', 'chemical_generator_idle'],
|
|
||||||
['matter_bottler', 'matter_bottler_idle'],
|
|
||||||
'drive_rack',
|
|
||||||
'item_monitor',
|
|
||||||
];
|
|
||||||
|
|
||||||
const fs = require('fs')
|
|
||||||
const _root = './src/main/resources/assets/overdrive_that_matters/'
|
|
||||||
const root_data = './src/main/resources/data/overdrive_that_matters/'
|
|
||||||
const root = _root + 'models/block/'
|
|
||||||
|
|
||||||
const time = Date.now()
|
|
||||||
process.stdout.write('Regenerating data files\n')
|
|
||||||
|
|
||||||
// "модель" горизонта событий / черной дыры
|
|
||||||
{
|
|
||||||
const elements = []
|
|
||||||
|
|
||||||
// сфера
|
|
||||||
const layers = 32
|
|
||||||
const radius = 2
|
|
||||||
|
|
||||||
// создание
|
|
||||||
for (let y = -layers / 2; y < layers / 2; y++) {
|
|
||||||
for (let x = -layers / 2; x < layers / 2; x++) {
|
|
||||||
for (let z = -layers / 2; z < layers / 2; z++) {
|
|
||||||
const dist1 = Math.sqrt(x * x + y * y + z * z)
|
|
||||||
|
|
||||||
if (dist1 <= radius) {
|
|
||||||
elements.push({
|
|
||||||
"from": [4 + (x + layers / 2) / layers * 8, 4 + (y + layers / 2) / layers * 8, 4 + (z + layers / 2) / layers * 8],
|
|
||||||
"to": [4 + (x + layers / 2 + 1) / layers * 8, 4 + (y + layers / 2 + 1) / layers * 8, 4 + (z + layers / 2 + 1) / layers * 8],
|
|
||||||
"faces": {
|
|
||||||
"down": { "texture": "#black_hole" },
|
|
||||||
"up": { "texture": "#black_hole" },
|
|
||||||
"north": { "texture": "#black_hole" },
|
|
||||||
"south": { "texture": "#black_hole" },
|
|
||||||
"west": { "texture": "#black_hole" },
|
|
||||||
"east": { "texture": "#black_hole" }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync(root + 'black_hole.json', JSON.stringify({
|
|
||||||
"parent": "block/block",
|
|
||||||
"textures": {
|
|
||||||
"black_hole": "overdrive_that_matters:block/black_hole"
|
|
||||||
},
|
|
||||||
"elements": elements
|
|
||||||
}, null, '\t'))
|
|
||||||
}
|
|
||||||
|
|
||||||
const handle = fs.openSync('./src/main/java/ru/dbotthepony/mc/otm/shapes/BlockShapes.java', 'w')
|
|
||||||
|
|
||||||
fs.writeSync(handle, 'package ru.dbotthepony.mc.otm.shapes;\n\n\n')
|
|
||||||
fs.writeSync(handle, `// This file is regenerated on each gradle run. Do not edit it!\n`)
|
|
||||||
fs.writeSync(handle, 'public class BlockShapes {\n')
|
|
||||||
|
|
||||||
// модели блоков
|
|
||||||
for (const _model of models) {
|
|
||||||
let model, path
|
|
||||||
|
|
||||||
if (Array.isArray(_model)) {
|
|
||||||
model = _model[0]
|
|
||||||
path = _model[1]
|
|
||||||
} else {
|
|
||||||
model = _model
|
|
||||||
path = _model
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeSync(handle, '\tpublic static final BlockShape ' + model.toUpperCase() + ' = new BlockShape(\n')
|
|
||||||
|
|
||||||
const obj = JSON.parse(fs.readFileSync(root + path + '.json', {encoding: 'utf-8'}))
|
|
||||||
let first = true
|
|
||||||
|
|
||||||
for (const elementID in obj.elements) {
|
|
||||||
const element = obj.elements[elementID]
|
|
||||||
|
|
||||||
if (element.rotation)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const from = element.from
|
|
||||||
const to = element.to
|
|
||||||
|
|
||||||
if (first) {
|
|
||||||
first = false
|
|
||||||
} else {
|
|
||||||
fs.writeSync(handle, ',\n')
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeSync(handle, `\t\tnew SimpleCuboid(${from[0] / 16}d, ${from[1] / 16}d, ${from[2] / 16}d, ${to[0] / 16}d, ${to[1] / 16}d, ${to[2] / 16}d)`)
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeSync(handle, '\n\t);\n\n')
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeSync(handle, '}')
|
|
||||||
fs.closeSync(handle)
|
|
||||||
|
|
||||||
const facings = [
|
|
||||||
{facing: "north", y: 0},
|
|
||||||
{facing: "south", y: 180},
|
|
||||||
{facing: "west", y: 270},
|
|
||||||
{facing: "east", y: 90},
|
|
||||||
]
|
|
||||||
|
|
||||||
// генерируем 6 моделей паттернов
|
|
||||||
{
|
|
||||||
const pattern_storage_pattern = JSON.parse(fs.readFileSync(root + 'pattern/pattern_storage_pattern.json'))
|
|
||||||
|
|
||||||
const pattern_list = ['overdrive_that_matters:block/pattern/pattern_storage_pattern'];
|
|
||||||
|
|
||||||
for (let i = 0; i < 7; i++) {
|
|
||||||
pattern_storage_pattern.elements[0].from[0] -= 2
|
|
||||||
pattern_storage_pattern.elements[0].to[0] -= 2
|
|
||||||
|
|
||||||
fs.writeFileSync(root + 'pattern/pattern_storage_pattern' + i + '.json', JSON.stringify(pattern_storage_pattern, null, '\t'))
|
|
||||||
pattern_list.push('overdrive_that_matters:block/pattern/pattern_storage_pattern' + i)
|
|
||||||
}
|
|
||||||
|
|
||||||
const base_model = 'overdrive_that_matters:block/pattern_storage'
|
|
||||||
|
|
||||||
const blockstate = {
|
|
||||||
multipart: []
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const face of facings) {
|
|
||||||
blockstate.multipart.push({
|
|
||||||
when: {
|
|
||||||
facing: face.facing
|
|
||||||
},
|
|
||||||
|
|
||||||
apply: {
|
|
||||||
model: base_model,
|
|
||||||
y: face.y ? face.y : undefined
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < 8; i++) {
|
|
||||||
for (const face of facings) {
|
|
||||||
blockstate.multipart.push({
|
|
||||||
when: {
|
|
||||||
facing: face.facing,
|
|
||||||
["disk_" + i]: true
|
|
||||||
},
|
|
||||||
|
|
||||||
apply: {
|
|
||||||
model: pattern_list[i],
|
|
||||||
y: face.y ? face.y : undefined
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync(_root + 'blockstates/pattern_storage.json', JSON.stringify(blockstate, null, '\t'))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Компоненты для крафта (как предмет)
|
|
||||||
{
|
|
||||||
const components = [
|
|
||||||
'tritanium_ingot',
|
|
||||||
'matter_io_port',
|
|
||||||
'matter_transform_matrix',
|
|
||||||
'energy_bus',
|
|
||||||
'electric_parts',
|
|
||||||
// 'machine_frame',
|
|
||||||
'tritanium_plate',
|
|
||||||
'iron_plate',
|
|
||||||
'copper_wiring',
|
|
||||||
'gold_wiring',
|
|
||||||
// 'portable_condensation_drive_casing',
|
|
||||||
// 'portable_dense_condensation_drive_casing',
|
|
||||||
'circuit_plating',
|
|
||||||
'basic_control_circuit',
|
|
||||||
'advanced_control_circuit',
|
|
||||||
]
|
|
||||||
|
|
||||||
for (const item of components) {
|
|
||||||
fs.writeFileSync(_root + 'models/item/' + item + '.json', JSON.stringify(
|
|
||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/component/" + item
|
|
||||||
}
|
|
||||||
}
|
|
||||||
, null, '\t'))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drive Viewer
|
|
||||||
{
|
|
||||||
const states = ['idle', 'working']
|
|
||||||
const machine = 'drive_viewer'
|
|
||||||
|
|
||||||
const blockstate = {
|
|
||||||
multipart: []
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const face of facings) {
|
|
||||||
for (const state of states) {
|
|
||||||
blockstate.multipart.push({
|
|
||||||
when: {
|
|
||||||
facing: face.facing,
|
|
||||||
worker: state
|
|
||||||
},
|
|
||||||
|
|
||||||
apply: {
|
|
||||||
model: 'overdrive_that_matters:block/' + machine + '_' + state,
|
|
||||||
y: face.y ? face.y : undefined
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
blockstate.multipart.push({
|
|
||||||
when: {
|
|
||||||
facing: face.facing,
|
|
||||||
drive: true
|
|
||||||
},
|
|
||||||
|
|
||||||
apply: {
|
|
||||||
model: 'overdrive_that_matters:block/' + machine + '_drive_part',
|
|
||||||
y: face.y ? face.y : undefined
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync(_root + 'blockstates/' + machine + '.json', JSON.stringify(blockstate, null, '\t'))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Машины с WorkerState
|
|
||||||
{
|
|
||||||
const to_generate = ['matter_scanner', 'matter_replicator', 'matter_decomposer']
|
|
||||||
const to_generate_semi = ['matter_bottler']
|
|
||||||
const states = ['idle', 'working', 'error']
|
|
||||||
const states_semi = ['idle', 'working']
|
|
||||||
|
|
||||||
for (const machine of to_generate) {
|
|
||||||
const blockstate = {
|
|
||||||
multipart: []
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const face of facings) {
|
|
||||||
for (const state of states) {
|
|
||||||
blockstate.multipart.push({
|
|
||||||
when: {
|
|
||||||
facing: face.facing,
|
|
||||||
worker: state
|
|
||||||
},
|
|
||||||
|
|
||||||
apply: {
|
|
||||||
model: 'overdrive_that_matters:block/' + machine + '_' + state,
|
|
||||||
y: face.y ? face.y : undefined
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync(_root + 'blockstates/' + machine + '.json', JSON.stringify(blockstate, null, '\t'))
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const machine of to_generate_semi) {
|
|
||||||
const blockstate = {
|
|
||||||
multipart: []
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const face of facings) {
|
|
||||||
for (const state of states_semi) {
|
|
||||||
blockstate.multipart.push({
|
|
||||||
when: {
|
|
||||||
facing: face.facing,
|
|
||||||
worker: state
|
|
||||||
},
|
|
||||||
|
|
||||||
apply: {
|
|
||||||
model: 'overdrive_that_matters:block/' + machine + '_' + state,
|
|
||||||
y: face.y ? face.y : undefined
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync(_root + 'blockstates/' + machine + '.json', JSON.stringify(blockstate, null, '\t'))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// просто дропы блоков
|
|
||||||
{
|
|
||||||
const blocks = [
|
|
||||||
'cargo_crate',
|
|
||||||
'matter_cable',
|
|
||||||
'tritanium_block',
|
|
||||||
'tritanium_striped_block',
|
|
||||||
'carbon_fibre_block',
|
|
||||||
|
|
||||||
'crate_red',
|
|
||||||
'crate_blue',
|
|
||||||
'crate_yellow',
|
|
||||||
'crate_green',
|
|
||||||
'crate_black',
|
|
||||||
'crate_pink',
|
|
||||||
'crate_purple',
|
|
||||||
|
|
||||||
'tritanium_raw_block',
|
|
||||||
]
|
|
||||||
|
|
||||||
for (const name of blocks) {
|
|
||||||
fs.writeFileSync(root_data + 'loot_tables/blocks/' + name + '.json', JSON.stringify({
|
|
||||||
"type": "minecraft:block",
|
|
||||||
"pools": [
|
|
||||||
{
|
|
||||||
"rolls": 1,
|
|
||||||
"bonus_rolls": 0,
|
|
||||||
"entries": [
|
|
||||||
{
|
|
||||||
"type": "minecraft:item",
|
|
||||||
"name": "overdrive_that_matters:" + name
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, null, '\t'))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cargo Crate
|
|
||||||
{
|
|
||||||
const blockstate = {
|
|
||||||
variants: {}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const face of facings) {
|
|
||||||
for (const open of [true, false]) {
|
|
||||||
blockstate.variants['facing=' + face.facing + ',open=' + open] = {
|
|
||||||
model: 'overdrive_that_matters:block/cargo_crate_' + (open ? 'open' : 'closed'),
|
|
||||||
y: face.y
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync(_root + 'blockstates/cargo_crate.json', JSON.stringify(blockstate, null, '\t'))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Обычные блокстейты для ресурсов
|
|
||||||
{
|
|
||||||
const blocks = [
|
|
||||||
'tritanium_ore',
|
|
||||||
'tritanium_raw_block',
|
|
||||||
'deepslate_tritanium_ore',
|
|
||||||
]
|
|
||||||
|
|
||||||
for (const name of blocks) {
|
|
||||||
const blockstate = {
|
|
||||||
"variants": {
|
|
||||||
"": [
|
|
||||||
{
|
|
||||||
"model": "overdrive_that_matters:block/" + name,
|
|
||||||
"weight": 10
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const x of [0, 90, 180]) {
|
|
||||||
for (const y of [0, 90, 180, 270]) {
|
|
||||||
blockstate.variants[''].push({
|
|
||||||
"model": "overdrive_that_matters:block/" + name,
|
|
||||||
"weight": 1,
|
|
||||||
"x": x,
|
|
||||||
"y": y
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync(_root + 'blockstates/' + name + '.json', JSON.stringify(blockstate, null, '\t'))
|
|
||||||
|
|
||||||
fs.writeFileSync(_root + 'models/item/' + name + '.json', JSON.stringify({
|
|
||||||
"parent": "overdrive_that_matters:block/" + name
|
|
||||||
}, null, '\t'))
|
|
||||||
|
|
||||||
fs.writeFileSync(_root + 'models/block/' + name + '.json', JSON.stringify({
|
|
||||||
"parent": "block/cube_all",
|
|
||||||
"textures": {
|
|
||||||
"all": "overdrive_that_matters:block/resource/" + name
|
|
||||||
}
|
|
||||||
}, null, '\t'))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Обычные блокстейты
|
|
||||||
{
|
|
||||||
const blocks = [
|
|
||||||
'tritanium_block',
|
|
||||||
'tritanium_striped_block',
|
|
||||||
'carbon_fibre_block',
|
|
||||||
|
|
||||||
'crate_red',
|
|
||||||
'crate_blue',
|
|
||||||
'crate_yellow',
|
|
||||||
'crate_green',
|
|
||||||
'crate_black',
|
|
||||||
'crate_pink',
|
|
||||||
'crate_purple',
|
|
||||||
|
|
||||||
'black_hole',
|
|
||||||
]
|
|
||||||
|
|
||||||
const blocks2 = [
|
|
||||||
'tritanium_block',
|
|
||||||
'carbon_fibre_block',
|
|
||||||
|
|
||||||
'crate_red',
|
|
||||||
'crate_blue',
|
|
||||||
'crate_yellow',
|
|
||||||
'crate_green',
|
|
||||||
'crate_black',
|
|
||||||
'crate_pink',
|
|
||||||
'crate_purple',
|
|
||||||
]
|
|
||||||
|
|
||||||
for (const name of blocks) {
|
|
||||||
fs.writeFileSync(_root + 'blockstates/' + name + '.json', JSON.stringify({
|
|
||||||
"variants": {
|
|
||||||
"": {
|
|
||||||
"model": "overdrive_that_matters:block/" + name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, null, '\t'))
|
|
||||||
|
|
||||||
fs.writeFileSync(_root + 'models/item/' + name + '.json', JSON.stringify({
|
|
||||||
"parent": "overdrive_that_matters:block/" + name
|
|
||||||
}, null, '\t'))
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const name of blocks2) {
|
|
||||||
fs.writeFileSync(_root + 'models/block/' + name + '.json', JSON.stringify({
|
|
||||||
"parent": "block/cube_all",
|
|
||||||
"textures": {
|
|
||||||
"all": "overdrive_that_matters:block/decorative/" + name
|
|
||||||
}
|
|
||||||
}, null, '\t'))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// дропы с машин
|
|
||||||
{
|
|
||||||
const drops = {
|
|
||||||
android_station: ['energy_cap', 'battery_container'],
|
|
||||||
battery_bank: ['battery_bank'],
|
|
||||||
matter_capacitor_bank: ['matter_container'],
|
|
||||||
|
|
||||||
drive_viewer: ['energy_cap', 'battery_container', 'drive_slot'],
|
|
||||||
matter_bottler: ['energy_cap', 'battery_container', 'work_slots', 'work_flow', 'matter_capability'],
|
|
||||||
|
|
||||||
matter_panel: ['tasks'],
|
|
||||||
pattern_storage: ['patterns'],
|
|
||||||
}
|
|
||||||
|
|
||||||
const drops_workers = {
|
|
||||||
matter_decomposer: ['work_slots', 'matter_capability'],
|
|
||||||
matter_replicator: ['regular_slots', 'reserved_slots', 'matter_capability'],
|
|
||||||
matter_scanner: ['work_slots'],
|
|
||||||
}
|
|
||||||
|
|
||||||
const combined = {}
|
|
||||||
|
|
||||||
for (const name in drops) {
|
|
||||||
combined[name] = drops[name]
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const name in drops_workers) {
|
|
||||||
drops_workers[name].push('work_ticks', 'current_job', 'energy_cap', 'battery_container')
|
|
||||||
combined[name] = drops_workers[name]
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const name in combined) {
|
|
||||||
const values = combined[name]
|
|
||||||
|
|
||||||
const state = {
|
|
||||||
type: 'minecraft:block',
|
|
||||||
pools: [
|
|
||||||
{
|
|
||||||
rolls: 1,
|
|
||||||
bonus_rolls: 0,
|
|
||||||
entries: [
|
|
||||||
{
|
|
||||||
type: 'minecraft:item',
|
|
||||||
name: "overdrive_that_matters:" + name,
|
|
||||||
functions: [
|
|
||||||
{
|
|
||||||
"function": "minecraft:copy_name",
|
|
||||||
"source": "block_entity"
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"function": "minecraft:copy_nbt",
|
|
||||||
"source": "block_entity",
|
|
||||||
"ops": [
|
|
||||||
{
|
|
||||||
"source": "Name",
|
|
||||||
"target": "BlockEntityTag.Name",
|
|
||||||
"op": "replace"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const type of values) {
|
|
||||||
state.pools[0].entries[0].functions[1].ops.push({
|
|
||||||
"source": type,
|
|
||||||
"target": "BlockEntityTag." + type,
|
|
||||||
"op": "replace"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync(root_data + 'loot_tables/blocks/' + name + '.json', JSON.stringify(state, null, '\t'))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// генерация моделей для battery bank и matter capacitor bank
|
|
||||||
{
|
|
||||||
let back = JSON.parse(fs.readFileSync(root + 'battery/battery_back.json'))
|
|
||||||
let front = JSON.parse(fs.readFileSync(root + 'battery/battery_front.json'))
|
|
||||||
const stepx = 12 / 3
|
|
||||||
const stepy = 6
|
|
||||||
|
|
||||||
const battery_list = ['overdrive_that_matters:block/battery/battery_front'];
|
|
||||||
const matter_list = [];
|
|
||||||
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
if (i == 2) {
|
|
||||||
front = JSON.parse(fs.readFileSync(root + 'battery/battery_front.json'))
|
|
||||||
front.elements[0].from[1] += stepy
|
|
||||||
front.elements[0].to[1] += stepy
|
|
||||||
} else {
|
|
||||||
front.elements[0].from[0] -= stepx
|
|
||||||
front.elements[0].to[0] -= stepx
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync(root + 'battery/battery_front' + i + '.json', JSON.stringify(front, null, '\t'))
|
|
||||||
battery_list.push('overdrive_that_matters:block/battery/battery_front' + i)
|
|
||||||
}
|
|
||||||
|
|
||||||
battery_list.push('overdrive_that_matters:block/battery/battery_back')
|
|
||||||
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
if (i == 2) {
|
|
||||||
back = JSON.parse(fs.readFileSync(root + 'battery/battery_back.json'))
|
|
||||||
back.elements[0].from[1] += stepy
|
|
||||||
back.elements[0].to[1] += stepy
|
|
||||||
} else {
|
|
||||||
back.elements[0].from[0] += stepx
|
|
||||||
back.elements[0].to[0] += stepx
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync(root + 'battery/battery_back' + i + '.json', JSON.stringify(back, null, '\t'))
|
|
||||||
battery_list.push('overdrive_that_matters:block/battery/battery_back' + i)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < battery_list.length; i++) {
|
|
||||||
fs.writeFileSync(root + 'battery/matter_capacitor' + i + '.json', JSON.stringify({
|
|
||||||
parent: battery_list[i],
|
|
||||||
textures: {
|
|
||||||
"1": "overdrive_that_matters:block/matterybank_core"
|
|
||||||
}
|
|
||||||
}, null, '\t'))
|
|
||||||
|
|
||||||
matter_list.push('overdrive_that_matters:block/battery/matter_capacitor' + i)
|
|
||||||
}
|
|
||||||
|
|
||||||
const list = [
|
|
||||||
['overdrive_that_matters:block/battery_bank', battery_list, 'blockstates/battery_bank.json'],
|
|
||||||
['overdrive_that_matters:block/matter_capacitor_bank', matter_list, 'blockstates/matter_capacitor_bank.json'],
|
|
||||||
]
|
|
||||||
|
|
||||||
for (const [base_model, models, path] of list) {
|
|
||||||
|
|
||||||
const blockstate = {
|
|
||||||
multipart: []
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const face of facings) {
|
|
||||||
blockstate.multipart.push({
|
|
||||||
when: {
|
|
||||||
facing: face.facing
|
|
||||||
},
|
|
||||||
|
|
||||||
apply: {
|
|
||||||
model: base_model,
|
|
||||||
y: face.y ? face.y : undefined
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < 12; i++) {
|
|
||||||
for (const face of facings) {
|
|
||||||
blockstate.multipart.push({
|
|
||||||
when: {
|
|
||||||
facing: face.facing,
|
|
||||||
["battery_" + i]: true
|
|
||||||
},
|
|
||||||
|
|
||||||
apply: {
|
|
||||||
model: models[i],
|
|
||||||
y: face.y ? face.y : undefined
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync(_root + path, JSON.stringify(blockstate, null, '\t'))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
process.stdout.write(`Regenerated data files in ${Date.now() - time}ms\n`)
|
|
@ -2,47 +2,234 @@ package ru.dbotthepony.mc.otm.datagen
|
|||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
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.BlockStateProvider
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent
|
import net.minecraftforge.eventbus.api.SubscribeEvent
|
||||||
import net.minecraftforge.fml.common.Mod
|
import net.minecraftforge.fml.common.Mod
|
||||||
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent
|
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||||
import ru.dbotthepony.mc.otm.Registry
|
import ru.dbotthepony.mc.otm.Registry.Blocks
|
||||||
import ru.dbotthepony.mc.otm.datagen.blocks.BatteryBankProvider
|
import ru.dbotthepony.mc.otm.Registry.Items
|
||||||
import ru.dbotthepony.mc.otm.datagen.blocks.MatterBankProvider
|
import ru.dbotthepony.mc.otm.block.BlockDriveViewer
|
||||||
import ru.dbotthepony.mc.otm.datagen.blocks.SimpleBlockProvider
|
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
|
||||||
import ru.dbotthepony.mc.otm.datagen.blocks.SimpleBlockStateProvider
|
import ru.dbotthepony.mc.otm.block.BlockPatternStorage
|
||||||
|
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
||||||
|
import ru.dbotthepony.mc.otm.datagen.blocks.*
|
||||||
|
import ru.dbotthepony.mc.otm.datagen.items.SimpleItemModelProvider
|
||||||
|
import ru.dbotthepony.mc.otm.datagen.loot.MatteryLootTableProvider
|
||||||
|
import ru.dbotthepony.mc.otm.datagen.loot.TileNbtCopy
|
||||||
|
import ru.dbotthepony.mc.otm.datagen.models.BlockMatteryModelProvider
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(modid = DataGen.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
@Mod.EventBusSubscriber(modid = DataGen.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||||
object DataGen {
|
object DataGen {
|
||||||
const val MOD_ID = OverdriveThatMatters.MOD_ID
|
const val MOD_ID = OverdriveThatMatters.MOD_ID
|
||||||
|
|
||||||
private lateinit var blockModelProvider: SimpleBlockProvider
|
private lateinit var blockModelProvider: BlockMatteryModelProvider
|
||||||
private lateinit var blockStateProvider: SimpleBlockStateProvider
|
private lateinit var blockStateProvider: SimpleBlockStateProvider
|
||||||
|
private lateinit var itemModelProvider: SimpleItemModelProvider
|
||||||
|
private lateinit var advancedBlockStateProvider: AdvancedBlockStateProvider
|
||||||
|
private lateinit var lootTableProvider: MatteryLootTableProvider
|
||||||
|
|
||||||
private fun decorativeCubeAll(vararg blocks: Block) {
|
private fun decorativeCubeAll(vararg blocks: Block) {
|
||||||
blockModelProvider.decorativeCubeAll(*blocks)
|
blockModelProvider.decorativeCubeAll(*blocks)
|
||||||
blockStateProvider.addBlock(*blocks)
|
blockStateProvider.block(*blocks)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun resourceCubeAll(vararg blocks: Block) {
|
||||||
|
blockModelProvider.resourceCubeAll(*blocks)
|
||||||
|
blockStateProvider.block(*blocks)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun decorativeColumn(block: Block, end: String, side: String) {
|
||||||
|
blockModelProvider.decorativeColumn(block, end, side)
|
||||||
|
blockStateProvider.block(block)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
fun onGatherData(event: GatherDataEvent) {
|
fun onGatherData(event: GatherDataEvent) {
|
||||||
blockModelProvider = SimpleBlockProvider(event)
|
blockModelProvider = BlockMatteryModelProvider(event)
|
||||||
blockStateProvider = SimpleBlockStateProvider(event)
|
blockStateProvider = SimpleBlockStateProvider(event)
|
||||||
|
itemModelProvider = SimpleItemModelProvider(event)
|
||||||
|
advancedBlockStateProvider = AdvancedBlockStateProvider(event)
|
||||||
|
lootTableProvider = MatteryLootTableProvider(event.generator)
|
||||||
|
|
||||||
event.generator.addProvider(blockModelProvider)
|
event.generator.addProvider(blockModelProvider)
|
||||||
|
event.generator.addProvider(itemModelProvider)
|
||||||
event.generator.addProvider(blockStateProvider)
|
event.generator.addProvider(blockStateProvider)
|
||||||
|
event.generator.addProvider(advancedBlockStateProvider)
|
||||||
|
|
||||||
decorativeCubeAll(*Registry.Blocks.CRATES)
|
decorativeCubeAll(*Blocks.CRATES)
|
||||||
decorativeCubeAll(Registry.Blocks.CARBON_FIBRE_BLOCK)
|
decorativeCubeAll(Blocks.CARBON_FIBRE_BLOCK)
|
||||||
decorativeCubeAll(Registry.Blocks.TRITANIUM_BLOCK)
|
decorativeCubeAll(Blocks.TRITANIUM_BLOCK)
|
||||||
decorativeCubeAll(Registry.Blocks.TRITANIUM_STRIPED_BLOCK)
|
|
||||||
|
|
||||||
blockStateProvider.addBlock(Registry.Blocks.BLACK_HOLE)
|
blockModelProvider.resourceCubeAll(Blocks.TRITANIUM_ORE)
|
||||||
|
blockModelProvider.resourceCubeAll(Blocks.TRITANIUM_RAW_BLOCK)
|
||||||
|
blockModelProvider.resourceCubeAll(Blocks.DEEPSLATE_TRITANIUM_ORE)
|
||||||
|
|
||||||
|
decorativeColumn(Blocks.TRITANIUM_STRIPED_BLOCK, "tritanium_block", "tritanium_striped_block")
|
||||||
|
|
||||||
|
with(blockModelProvider) {
|
||||||
|
lambda {
|
||||||
|
copy("block/battery/battery1", "block/battery/battery0").also { it.offset(-4f, 0f, 0f) }
|
||||||
|
copy("block/battery/battery2", "block/battery/battery0").also { it.offset(-8f, 0f, 0f) }
|
||||||
|
|
||||||
|
copy("block/battery/battery3", "block/battery/battery0").also { it.offset(0f, 6f, 0f) }
|
||||||
|
copy("block/battery/battery4", "block/battery/battery0").also { it.offset(-4f, 6f, 0f) }
|
||||||
|
copy("block/battery/battery5", "block/battery/battery0").also { it.offset(-8f, 6f, 0f) }
|
||||||
|
|
||||||
|
copy("block/battery/battery7", "block/battery/battery6").also { it.offset(4f, 0f, 0f) }
|
||||||
|
copy("block/battery/battery8", "block/battery/battery6").also { it.offset(8f, 0f, 0f) }
|
||||||
|
|
||||||
|
copy("block/battery/battery9", "block/battery/battery6").also { it.offset(0f, 6f, 0f) }
|
||||||
|
copy("block/battery/battery10", "block/battery/battery6").also { it.offset(4f, 6f, 0f) }
|
||||||
|
copy("block/battery/battery11", "block/battery/battery6").also { it.offset(8f, 6f, 0f) }
|
||||||
|
|
||||||
|
for (i in 0 .. 11) {
|
||||||
|
withExistingParent("block/battery/matter_capacitor$i", ResourceLocation(MOD_ID, "block/battery/battery$i"))
|
||||||
|
.texture("1", "block/matterybank_core")
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i in 1 .. 7) {
|
||||||
|
copy("block/pattern/model$i", "block/pattern/model0").also { it.offset(-2f * i, 0f, 0f) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
with(blockStateProvider) {
|
||||||
|
block(Blocks.BLACK_HOLE)
|
||||||
|
block(Blocks.ANDROID_STATION)
|
||||||
|
|
||||||
|
ore(Blocks.DEEPSLATE_TRITANIUM_ORE)
|
||||||
|
ore(Blocks.TRITANIUM_ORE)
|
||||||
|
ore(Blocks.TRITANIUM_RAW_BLOCK)
|
||||||
|
}
|
||||||
|
|
||||||
event.generator.addProvider(MatterBankProvider(event))
|
event.generator.addProvider(MatterBankProvider(event))
|
||||||
event.generator.addProvider(BatteryBankProvider(event))
|
event.generator.addProvider(BatteryBankProvider(event))
|
||||||
|
|
||||||
|
event.generator.addProvider(lootTableProvider)
|
||||||
|
|
||||||
|
with(advancedBlockStateProvider) {
|
||||||
|
block(Blocks.CHEMICAL_GENERATOR)
|
||||||
|
block(Blocks.MATTER_SCANNER)
|
||||||
|
block(Blocks.ITEM_MONITOR)
|
||||||
|
block(Blocks.MATTER_BOTTLER)
|
||||||
|
block(Blocks.MATTER_DECOMPOSER)
|
||||||
|
block(Blocks.MATTER_REPLICATOR)
|
||||||
|
}
|
||||||
|
|
||||||
|
with(itemModelProvider) {
|
||||||
|
block(Items.ANDROID_STATION)
|
||||||
|
block(Items.BATTERY_BANK)
|
||||||
|
block(Items.MATTER_CAPACITOR_BANK)
|
||||||
|
block(Items.PATTERN_STORAGE)
|
||||||
|
block(Items.BLACK_HOLE)
|
||||||
|
block(Items.CARBON_FIBRE_BLOCK)
|
||||||
|
block(Items.DEEPSLATE_TRITANIUM_ORE)
|
||||||
|
block(Items.TRITANIUM_ORE)
|
||||||
|
block(Items.TRITANIUM_STRIPED_BLOCK)
|
||||||
|
block(Items.TRITANIUM_RAW_BLOCK)
|
||||||
|
block(Items.ITEM_MONITOR)
|
||||||
|
|
||||||
|
blocks(*Items.CRATES)
|
||||||
|
|
||||||
|
components(*Items.DATAGEN_COMPONENTS)
|
||||||
|
|
||||||
|
generated(Items.PILL_ANDROID)
|
||||||
|
generated(Items.PILL_HUMANE)
|
||||||
|
generated(Items.NUTRIENT_PASTE)
|
||||||
|
component(Items.TRITANIUM_INGOT)
|
||||||
|
resource(Items.TRITANIUM_ORE_CLUMP)
|
||||||
|
|
||||||
|
generatedTiered(Items.BATTERIES, "battery_tier")
|
||||||
|
generated(Items.BATTERY_CREATIVE)
|
||||||
|
|
||||||
|
generated(Items.MATTER_CAPACITOR_BASIC, ResourceLocation(MOD_ID, "item/matter_capacitor_tier1"))
|
||||||
|
generated(Items.MATTER_CAPACITOR_NORMAL, ResourceLocation(MOD_ID, "item/matter_capacitor_tier2"))
|
||||||
|
generated(Items.MATTER_CAPACITOR_DENSE, ResourceLocation(MOD_ID, "item/matter_capacitor_tier3"))
|
||||||
|
generated(Items.MATTER_CAPACITOR_CREATIVE)
|
||||||
|
|
||||||
|
generated(Items.PATTERN_DRIVE_CREATIVE)
|
||||||
|
|
||||||
|
block(Items.CARGO_CRATE, "cargo_crate_closed")
|
||||||
|
block(Items.CHEMICAL_GENERATOR, "chemical_generator_working")
|
||||||
|
block(Items.ENERGY_COUNTER, "energy_counter_down")
|
||||||
|
block(Items.MATTER_BOTTLER, "matter_bottler_working")
|
||||||
|
block(Items.MATTER_CABLE, "matter_cable_core")
|
||||||
|
block(Items.MATTER_DECOMPOSER, "matter_decomposer_working")
|
||||||
|
}
|
||||||
|
|
||||||
|
event.generator.addProvider(object : BlockStateProvider(event.generator, MOD_ID, event.existingFileHelper) {
|
||||||
|
override fun registerStatesAndModels() {
|
||||||
|
with(getMultipartBuilder(Blocks.DRIVE_VIEWER)) {
|
||||||
|
for (facing in BlockMatteryRotatable.FACING.possibleValues) {
|
||||||
|
part()
|
||||||
|
.modelFile(models().getExistingFile(ResourceLocation(MOD_ID, "block/drive_viewer_drive_part")))
|
||||||
|
.rotationY(facing.toYRotBlockstate())
|
||||||
|
.addModel()
|
||||||
|
.condition(BlockMatteryRotatable.FACING, facing)
|
||||||
|
.condition(BlockDriveViewer.DRIVE_PRESENT, true)
|
||||||
|
|
||||||
|
for (workState in WorkerState.SEMI_WORKER_STATE.possibleValues) {
|
||||||
|
part()
|
||||||
|
.modelFile(models().getExistingFile(ResourceLocation(MOD_ID, "block/drive_viewer_${workState.name.lowercase()}")))
|
||||||
|
.rotationY(facing.toYRotBlockstate())
|
||||||
|
.addModel()
|
||||||
|
.condition(WorkerState.SEMI_WORKER_STATE, workState)
|
||||||
|
.condition(BlockMatteryRotatable.FACING, facing)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
with(getMultipartBuilder(Blocks.PATTERN_STORAGE)) {
|
||||||
|
for (facing in BlockMatteryRotatable.FACING.possibleValues) {
|
||||||
|
for (i in 0 .. 7) {
|
||||||
|
part()
|
||||||
|
.modelFile(models().getExistingFile(ResourceLocation(MOD_ID, "block/pattern/model$i")))
|
||||||
|
.rotationY(facing.toYRotBlockstate())
|
||||||
|
.addModel()
|
||||||
|
.condition(BlockMatteryRotatable.FACING, facing)
|
||||||
|
.condition(BlockPatternStorage.PATTERN_STORAGE_DISKS_PROPS[i], true)
|
||||||
|
}
|
||||||
|
|
||||||
|
part()
|
||||||
|
.modelFile(models().getExistingFile(ResourceLocation(MOD_ID, "block/pattern_storage")))
|
||||||
|
.rotationY(facing.toYRotBlockstate())
|
||||||
|
.addModel()
|
||||||
|
.condition(BlockMatteryRotatable.FACING, facing)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
val workerTags = arrayOf(
|
||||||
|
TileNbtCopy("work_ticks"),
|
||||||
|
TileNbtCopy("current_job"),
|
||||||
|
TileNbtCopy("battery_container"),
|
||||||
|
TileNbtCopy("energy_cap"),
|
||||||
|
)
|
||||||
|
|
||||||
|
with(lootTableProvider) {
|
||||||
|
simpleBlocks(*Blocks.CRATES)
|
||||||
|
simpleBlock(Blocks.CARGO_CRATE)
|
||||||
|
simpleBlock(Blocks.CARBON_FIBRE_BLOCK)
|
||||||
|
simpleBlock(Blocks.TRITANIUM_RAW_BLOCK)
|
||||||
|
simpleBlock(Blocks.TRITANIUM_BLOCK)
|
||||||
|
simpleBlock(Blocks.TRITANIUM_STRIPED_BLOCK)
|
||||||
|
simpleBlock(Blocks.MATTER_CABLE)
|
||||||
|
|
||||||
|
tile(Blocks.ANDROID_STATION, TileNbtCopy("energy_cap"), TileNbtCopy("battery_container"))
|
||||||
|
tile(Blocks.BATTERY_BANK, TileNbtCopy("battery_bank"))
|
||||||
|
tile(Blocks.DRIVE_VIEWER, TileNbtCopy("energy_cap"), TileNbtCopy("drive_slot"), TileNbtCopy("battery_container"))
|
||||||
|
|
||||||
|
tile(Blocks.MATTER_DECOMPOSER, TileNbtCopy("work_slots"), TileNbtCopy("matter_capability"), *workerTags)
|
||||||
|
tile(Blocks.MATTER_REPLICATOR, TileNbtCopy("regular_slots"), TileNbtCopy("reserved_slots"), TileNbtCopy("matter_capability"), *workerTags)
|
||||||
|
tile(Blocks.MATTER_SCANNER, TileNbtCopy("work_slots"), *workerTags)
|
||||||
|
tile(Blocks.MATTER_PANEL, TileNbtCopy("tasks"))
|
||||||
|
tile(Blocks.PATTERN_STORAGE, TileNbtCopy("patterns"))
|
||||||
|
tile(Blocks.MATTER_CAPACITOR_BANK, TileNbtCopy("matter_container"))
|
||||||
|
tile(Blocks.MATTER_BOTTLER, TileNbtCopy("energy_cap"), TileNbtCopy("battery_container"), TileNbtCopy("work_slots"), TileNbtCopy("work_flow"), TileNbtCopy("matter_capability"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package ru.dbotthepony.mc.otm.datagen
|
package ru.dbotthepony.mc.otm.datagen
|
||||||
|
|
||||||
|
import com.google.gson.JsonArray
|
||||||
|
import com.google.gson.JsonObject
|
||||||
import net.minecraft.core.Direction
|
import net.minecraft.core.Direction
|
||||||
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
|
import net.minecraft.world.level.block.state.properties.Property
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
fun Direction.toYRotBlockstate(): Int {
|
fun Direction.toYRotBlockstate(): Int {
|
||||||
@ -14,3 +18,13 @@ fun Direction.toYRotBlockstate(): Int {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun <T : Comparable<T>> BlockState.getValueNullable(prop: Property<T>): T? {
|
||||||
|
if (hasProperty(prop)) {
|
||||||
|
return getValue(prop)
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
operator fun JsonObject.set(s: String, value: JsonArray) = add(s, value)
|
||||||
|
|
||||||
|
@ -0,0 +1,65 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.datagen.blocks
|
||||||
|
|
||||||
|
import net.minecraft.resources.ResourceLocation
|
||||||
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
|
import net.minecraft.world.level.block.state.properties.Property
|
||||||
|
import net.minecraftforge.client.model.generators.BlockStateProvider
|
||||||
|
import net.minecraftforge.client.model.generators.ConfiguredModel
|
||||||
|
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent
|
||||||
|
import ru.dbotthepony.mc.otm.block.BlockMattery
|
||||||
|
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
|
||||||
|
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
||||||
|
import ru.dbotthepony.mc.otm.datagen.DataGen
|
||||||
|
import ru.dbotthepony.mc.otm.datagen.getValueNullable
|
||||||
|
import ru.dbotthepony.mc.otm.datagen.toYRotBlockstate
|
||||||
|
|
||||||
|
typealias AdvancedBlockStateFunction = (BlockState, ConfiguredModel.Builder<*>, String) -> String?
|
||||||
|
//typealias AdvancedBlockStateBoolFunction = (BlockState, ConfiguredModel.Builder<*>) -> String
|
||||||
|
|
||||||
|
private data class AdvancedBlockStateEntry(val block: BlockMattery, val func: AdvancedBlockStateFunction)
|
||||||
|
//data class BooleanPropertyMapping(val property: Property<Boolean>, val func: AdvancedBlockStateBoolFunction)
|
||||||
|
//private data class AdvancedBlockStateBooleanMapped(val block: BlockMattery, val mapping: Array<out BooleanPropertyMapping>)
|
||||||
|
|
||||||
|
private fun initialTransform(it: BlockState, modelPath: String, builder: ConfiguredModel.Builder<*>): String {
|
||||||
|
var modelPath = modelPath
|
||||||
|
|
||||||
|
it.getValueNullable(BlockMatteryRotatable.FACING)?.let {
|
||||||
|
builder.rotationY(it.toYRotBlockstate())
|
||||||
|
}
|
||||||
|
|
||||||
|
it.getValueNullable(WorkerState.WORKER_STATE)?.let {
|
||||||
|
modelPath += "_" + it.name.lowercase()
|
||||||
|
}
|
||||||
|
|
||||||
|
it.getValueNullable(WorkerState.SEMI_WORKER_STATE)?.let {
|
||||||
|
modelPath += "_" + it.name.lowercase()
|
||||||
|
}
|
||||||
|
|
||||||
|
return modelPath
|
||||||
|
}
|
||||||
|
|
||||||
|
class AdvancedBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
|
||||||
|
private val blocks = ArrayList<AdvancedBlockStateEntry>()
|
||||||
|
//private val boolMapped = ArrayList<AdvancedBlockStateBooleanMapped>()
|
||||||
|
|
||||||
|
fun block(block: BlockMattery) = blocks.add(AdvancedBlockStateEntry(block) { _, _, _ -> null })
|
||||||
|
fun block(block: BlockMattery, func: AdvancedBlockStateFunction) = blocks.add(AdvancedBlockStateEntry(block, func))
|
||||||
|
|
||||||
|
//fun multipartBoolBlock(block: BlockMattery, vararg props: BooleanPropertyMapping) {
|
||||||
|
// boolMapped.add(AdvancedBlockStateBooleanMapped(block, props))
|
||||||
|
//}
|
||||||
|
|
||||||
|
override fun registerStatesAndModels() {
|
||||||
|
for ((block, func) in blocks) {
|
||||||
|
getVariantBuilder(block).forAllStates {
|
||||||
|
val builder = ConfiguredModel.builder()
|
||||||
|
var modelPath = initialTransform(it, "block/${block.registryName!!.path}", builder)
|
||||||
|
modelPath = func(it, builder, modelPath) ?: modelPath
|
||||||
|
|
||||||
|
builder.modelFile(models().getExistingFile(ResourceLocation(DataGen.MOD_ID, modelPath)))
|
||||||
|
|
||||||
|
return@forAllStates arrayOf(builder.buildLast())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -19,8 +19,7 @@ private fun nothingOrNumber(input: Int): String {
|
|||||||
|
|
||||||
open class BatteryBankProvider(event: GatherDataEvent) : BlockStateProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
|
open class BatteryBankProvider(event: GatherDataEvent) : BlockStateProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
|
||||||
protected var block = "battery_bank"
|
protected var block = "battery_bank"
|
||||||
protected var batteryPath = "block/battery/battery_front"
|
protected var batteryPath = "block/battery/battery"
|
||||||
protected var mainline = true
|
|
||||||
protected var registry: Block = Registry.Blocks.BATTERY_BANK
|
protected var registry: Block = Registry.Blocks.BATTERY_BANK
|
||||||
|
|
||||||
override fun registerStatesAndModels() {
|
override fun registerStatesAndModels() {
|
||||||
@ -31,30 +30,12 @@ open class BatteryBankProvider(event: GatherDataEvent) : BlockStateProvider(even
|
|||||||
part().modelFile(battery_bank).rotationY(it.toYRotBlockstate()).addModel().condition(
|
part().modelFile(battery_bank).rotationY(it.toYRotBlockstate()).addModel().condition(
|
||||||
BlockMatteryRotatable.FACING, it)
|
BlockMatteryRotatable.FACING, it)
|
||||||
|
|
||||||
if (mainline) {
|
for (i in 0 .. 11) {
|
||||||
for (i in 0 .. 5) {
|
part().modelFile(
|
||||||
part().modelFile(
|
models().getExistingFile(ResourceLocation("overdrive_that_matters:$batteryPath$i"))
|
||||||
models().getExistingFile(ResourceLocation("overdrive_that_matters:$batteryPath${nothingOrNumber(i)}"))
|
).rotationY(it.toYRotBlockstate()).addModel()
|
||||||
).rotationY(it.toYRotBlockstate()).addModel()
|
.condition(BlockMatteryRotatable.FACING, it)
|
||||||
.condition(BlockMatteryRotatable.FACING, it)
|
.condition(BlockBatteryBank.BATTERY_SLOTS_PROPS[i], true)
|
||||||
.condition(BlockBatteryBank.BATTERY_SLOTS_PROPS[i], true)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i in 6 .. 11) {
|
|
||||||
part().modelFile(
|
|
||||||
models().getExistingFile(ResourceLocation("overdrive_that_matters:$batteryPath${nothingOrNumber(i - 6)}"))
|
|
||||||
).rotationY(it.toYRotBlockstate()).addModel()
|
|
||||||
.condition(BlockMatteryRotatable.FACING, it)
|
|
||||||
.condition(BlockBatteryBank.BATTERY_SLOTS_PROPS[i], true)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (i in 0 .. 11) {
|
|
||||||
part().modelFile(
|
|
||||||
models().getExistingFile(ResourceLocation("overdrive_that_matters:$batteryPath$i"))
|
|
||||||
).rotationY(it.toYRotBlockstate()).addModel()
|
|
||||||
.condition(BlockMatteryRotatable.FACING, it)
|
|
||||||
.condition(BlockBatteryBank.BATTERY_SLOTS_PROPS[i], true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +46,6 @@ class MatterBankProvider(event: GatherDataEvent) : BatteryBankProvider(event) {
|
|||||||
init {
|
init {
|
||||||
block = "matter_capacitor_bank"
|
block = "matter_capacitor_bank"
|
||||||
batteryPath = "block/battery/matter_capacitor"
|
batteryPath = "block/battery/matter_capacitor"
|
||||||
mainline = false
|
|
||||||
registry = Registry.Blocks.MATTER_CAPACITOR_BANK
|
registry = Registry.Blocks.MATTER_CAPACITOR_BANK
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
package ru.dbotthepony.mc.otm.datagen.blocks
|
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation
|
|
||||||
import net.minecraft.world.level.block.Block
|
|
||||||
import net.minecraftforge.client.model.generators.BlockModelProvider
|
|
||||||
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent
|
|
||||||
import ru.dbotthepony.mc.otm.datagen.DataGen
|
|
||||||
|
|
||||||
private data class CubeAllEntry(val path: String, val texture: ResourceLocation)
|
|
||||||
|
|
||||||
class SimpleBlockProvider(event: GatherDataEvent) : BlockModelProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
|
|
||||||
private val cubeAll = ArrayList<CubeAllEntry>()
|
|
||||||
|
|
||||||
override fun registerModels() {
|
|
||||||
for ((path, texture) in cubeAll) {
|
|
||||||
cubeAll(path, texture)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun decorativeCubeAll(vararg blocks: Block) {
|
|
||||||
for (it in blocks) {
|
|
||||||
cubeAll.add(CubeAllEntry(it.registryName!!.path, ResourceLocation("overdrive_that_matters:block/decorative/${it.registryName!!.path}")))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
package ru.dbotthepony.mc.otm.datagen.blocks
|
package ru.dbotthepony.mc.otm.datagen.blocks
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation
|
|
||||||
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
|
||||||
@ -9,9 +8,14 @@ import ru.dbotthepony.mc.otm.datagen.DataGen
|
|||||||
|
|
||||||
class SimpleBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
|
class SimpleBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
|
||||||
private val blocks = ArrayList<Block>()
|
private val blocks = ArrayList<Block>()
|
||||||
|
private val ores = ArrayList<Block>()
|
||||||
|
|
||||||
fun addBlock(vararg block: Block) {
|
fun block(vararg blocks: Block) {
|
||||||
blocks.addAll(block)
|
this.blocks.addAll(blocks)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ore(vararg blocks: Block) {
|
||||||
|
ores.addAll(blocks)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun registerStatesAndModels() {
|
override fun registerStatesAndModels() {
|
||||||
@ -21,5 +25,32 @@ class SimpleBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(even
|
|||||||
return@forAllStates arrayOf(ConfiguredModel(models().getExistingFile(block.registryName)))
|
return@forAllStates arrayOf(ConfiguredModel(models().getExistingFile(block.registryName)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (block in ores) {
|
||||||
|
var first = true
|
||||||
|
|
||||||
|
getVariantBuilder(block).forAllStates {
|
||||||
|
check(first) {"$block has more than one BlockState"}
|
||||||
|
first = false
|
||||||
|
|
||||||
|
check(block.registryName != null) {"$block registry name is null!"}
|
||||||
|
val localModel = models().getExistingFile(block.registryName)
|
||||||
|
|
||||||
|
val generated = ArrayList<ConfiguredModel>()
|
||||||
|
|
||||||
|
for (x in arrayOf(0, 90, 180)) {
|
||||||
|
for (y in arrayOf(0, 90, 180, 270)) {
|
||||||
|
generated.add(with(ConfiguredModel.builder()) {
|
||||||
|
rotationX(x)
|
||||||
|
rotationY(y)
|
||||||
|
modelFile(localModel)
|
||||||
|
return@with buildLast()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return@forAllStates generated.toTypedArray()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.datagen.items
|
||||||
|
|
||||||
|
import net.minecraft.resources.ResourceLocation
|
||||||
|
import net.minecraft.world.item.BlockItem
|
||||||
|
import net.minecraft.world.item.Item
|
||||||
|
import net.minecraftforge.client.model.generators.ItemModelProvider
|
||||||
|
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent
|
||||||
|
import ru.dbotthepony.mc.otm.datagen.DataGen
|
||||||
|
|
||||||
|
private data class ItemModelGenerated(val item: String, val path: ResourceLocation)
|
||||||
|
private data class ItemModelDelegate(val item: String, val path: ResourceLocation)
|
||||||
|
|
||||||
|
class SimpleItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
|
||||||
|
private val generated = ArrayList<ItemModelGenerated>()
|
||||||
|
private val delegates = ArrayList<ItemModelDelegate>()
|
||||||
|
|
||||||
|
override fun registerModels() {
|
||||||
|
for ((item, path) in generated) {
|
||||||
|
withExistingParent(item, GENERATED).texture("layer0", path)
|
||||||
|
}
|
||||||
|
|
||||||
|
for ((item, path) in delegates) {
|
||||||
|
withExistingParent(item, path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun block(item: Item) = delegates.add(ItemModelDelegate(item.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/${item.registryName!!.path}")))
|
||||||
|
fun block(item: Item, path: String) = delegates.add(ItemModelDelegate(item.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/$path")))
|
||||||
|
fun blocks(vararg items: Item) = items.forEach(this::block)
|
||||||
|
|
||||||
|
fun generated(item: Item, texture: ResourceLocation) {
|
||||||
|
generated.add(ItemModelGenerated(item.registryName!!.path, texture))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun generated(item: Item) = generated(item, ResourceLocation(DataGen.MOD_ID, "item/${item.registryName!!.path}"))
|
||||||
|
fun generated(item: Item, prefix: String) = generated(item, ResourceLocation(DataGen.MOD_ID, "item/${prefix}${item.registryName!!.path}"))
|
||||||
|
fun component(item: Item) = generated(item, "component/")
|
||||||
|
fun components(vararg items: Item) = items.forEach(this::component)
|
||||||
|
fun resource(item: Item) = generated(item, "resources/")
|
||||||
|
fun resources(vararg items: Item) = items.forEach(this::resource)
|
||||||
|
|
||||||
|
fun generatedTiered(items: Array<out Item>, prefix: String) {
|
||||||
|
var i = 0
|
||||||
|
|
||||||
|
for (item in items) {
|
||||||
|
generated(item, ResourceLocation(DataGen.MOD_ID, "item/$prefix$i"))
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private val GENERATED = ResourceLocation("minecraft", "item/generated")
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.datagen.loot
|
||||||
|
|
||||||
|
import com.mojang.datafixers.util.Pair
|
||||||
|
import net.minecraft.data.DataGenerator
|
||||||
|
import net.minecraft.data.loot.LootTableProvider
|
||||||
|
import net.minecraft.resources.ResourceLocation
|
||||||
|
import net.minecraft.world.level.block.Block
|
||||||
|
import net.minecraft.world.level.storage.loot.LootPool
|
||||||
|
import net.minecraft.world.level.storage.loot.LootTable
|
||||||
|
import net.minecraft.world.level.storage.loot.ValidationContext
|
||||||
|
import net.minecraft.world.level.storage.loot.entries.LootItem
|
||||||
|
import net.minecraft.world.level.storage.loot.functions.CopyNbtFunction
|
||||||
|
import net.minecraft.world.level.storage.loot.functions.LootItemFunctions
|
||||||
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet
|
||||||
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
|
||||||
|
import net.minecraft.world.level.storage.loot.providers.nbt.ContextNbtProvider
|
||||||
|
import java.util.function.BiConsumer
|
||||||
|
import java.util.function.Consumer
|
||||||
|
import java.util.function.Supplier
|
||||||
|
|
||||||
|
typealias LootBuilderCallback = BiConsumer<ResourceLocation, LootTable.Builder>
|
||||||
|
typealias LootBuilderWorker = Consumer<LootBuilderCallback>
|
||||||
|
typealias LootBuilderWorkerSupplier = Supplier<LootBuilderWorker>
|
||||||
|
typealias LootTuple = Pair<LootBuilderWorkerSupplier, LootContextParamSet>
|
||||||
|
|
||||||
|
fun singleLootPool(f: (LootPool.Builder) -> Unit): LootTable.Builder {
|
||||||
|
return LootTable.lootTable().withPool(LootPool.lootPool().also(f))
|
||||||
|
}
|
||||||
|
|
||||||
|
data class NbtCopy(val source: String, val destination: String, val strategy: CopyNbtFunction.MergeStrategy = CopyNbtFunction.MergeStrategy.REPLACE)
|
||||||
|
data class TileNbtCopy(val source: String, val strategy: CopyNbtFunction.MergeStrategy = CopyNbtFunction.MergeStrategy.REPLACE)
|
||||||
|
|
||||||
|
class MatteryLootTableProvider(generator: DataGenerator) : LootTableProvider(generator) {
|
||||||
|
private val providers = ArrayList<LootTuple>()
|
||||||
|
|
||||||
|
override fun getTables(): List<LootTuple> {
|
||||||
|
return providers
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun validate(map: MutableMap<ResourceLocation, LootTable>, validationtracker: ValidationContext) {}
|
||||||
|
|
||||||
|
fun block(provider: LootBuilderWorker) {
|
||||||
|
providers.add(Pair(Supplier {provider}, LootContextParamSets.BLOCK))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun simpleBlock(block: Block) {
|
||||||
|
block {
|
||||||
|
it.accept(block.registryName!!, singleLootPool {
|
||||||
|
it.add(LootItem.lootTableItem(block))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun simpleBlocks(vararg blocks: Block) {
|
||||||
|
blocks.forEach(this::simpleBlock)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun tile(block: Block, f: (CopyNbtFunction.Builder) -> Unit = {}) {
|
||||||
|
block {
|
||||||
|
it.accept(block.registryName!!, singleLootPool {
|
||||||
|
it.add(LootItem.lootTableItem(block).also {
|
||||||
|
it.apply(CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY).also {
|
||||||
|
it.copy("Name", "BlockEntityTag.Name")
|
||||||
|
f(it)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun tile(block: Block, vararg tags: NbtCopy) {
|
||||||
|
tile(block) {
|
||||||
|
for ((source, destination, strategy) in tags) {
|
||||||
|
it.copy(source, destination, strategy)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun tile(block: Block, vararg tags: TileNbtCopy) {
|
||||||
|
tile(block) {
|
||||||
|
for ((source, strategy) in tags) {
|
||||||
|
it.copy(source, "BlockEntityTag.$source", strategy)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,145 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.datagen.models
|
||||||
|
|
||||||
|
import com.google.gson.JsonArray
|
||||||
|
import com.google.gson.JsonObject
|
||||||
|
import com.google.gson.JsonPrimitive
|
||||||
|
import com.mojang.math.Vector3f
|
||||||
|
import net.minecraft.client.renderer.block.model.BlockModel
|
||||||
|
import net.minecraft.core.Direction
|
||||||
|
import net.minecraft.resources.ResourceLocation
|
||||||
|
import net.minecraftforge.client.model.generators.ModelBuilder
|
||||||
|
import net.minecraftforge.common.data.ExistingFileHelper
|
||||||
|
import ru.dbotthepony.mc.otm.datagen.set
|
||||||
|
|
||||||
|
data class TextureSize(val width: Float, val height: Float) {
|
||||||
|
constructor(arr: JsonArray) : this(arr[0].asFloat, arr[1].asFloat)
|
||||||
|
|
||||||
|
init {
|
||||||
|
require(width > 0f) { "Invalid width $width" }
|
||||||
|
require(height > 0f) { "Invalid width $height" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MatteryModelBuilder(resourceLocation: ResourceLocation, existingFileHelper: ExistingFileHelper) : ModelBuilder<MatteryModelBuilder>(resourceLocation, existingFileHelper) {
|
||||||
|
var textureSize: TextureSize? = null
|
||||||
|
|
||||||
|
fun fromJson(input: JsonObject) {
|
||||||
|
input["parent"]?.let {
|
||||||
|
parent(ExistingModelFile(ResourceLocation(it.asString), existingFileHelper))
|
||||||
|
}
|
||||||
|
|
||||||
|
input["ambientocclusion"]?.let {
|
||||||
|
ambientOcclusion = it.asBoolean
|
||||||
|
}
|
||||||
|
|
||||||
|
input["gui_light"]?.let {
|
||||||
|
guiLight = BlockModel.GuiLight.valueOf(it.asString)
|
||||||
|
}
|
||||||
|
|
||||||
|
(input["texture_size"] as? JsonArray)?.let {
|
||||||
|
textureSize = TextureSize(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
(input["textures"] as? JsonObject)?.let {
|
||||||
|
for ((k, v) in it.entrySet()) {
|
||||||
|
texture(k, v.asString)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
(input["elements"] as? JsonArray)?.let {
|
||||||
|
var i = -1
|
||||||
|
|
||||||
|
for (value in it) {
|
||||||
|
i++
|
||||||
|
check(value is JsonObject) { "Encountered invalid element at $i" }
|
||||||
|
element().fromJson(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun toJson(): JsonObject {
|
||||||
|
return super.toJson().also {
|
||||||
|
val textureSize = textureSize
|
||||||
|
|
||||||
|
if (textureSize != null) {
|
||||||
|
it["texture_size"] = JsonArray().also {
|
||||||
|
it.add(textureSize.width)
|
||||||
|
it.add(textureSize.height)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun element(): MatteryModelElement {
|
||||||
|
check(customLoader == null) { "Can not use custom loaders and elements at the same time" }
|
||||||
|
return MatteryModelElement().also(elements::add)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun element(index: Int): MatteryModelElement {
|
||||||
|
return super.element(index) as MatteryModelElement
|
||||||
|
}
|
||||||
|
|
||||||
|
fun offset(x: Float, y: Float, z: Float) {
|
||||||
|
for (element in elements) {
|
||||||
|
(element as MatteryModelElement).offset(x, y, z)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun offset(value: Vector3f) {
|
||||||
|
for (element in elements) {
|
||||||
|
(element as MatteryModelElement).offset(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class MatteryModelElement : ElementBuilder() {
|
||||||
|
private var from: Vector3f = Vector3f()
|
||||||
|
private var to: Vector3f = Vector3f(16f, 16f, 16f)
|
||||||
|
|
||||||
|
fun from(value: Vector3f) = from(value.x(), value.y(), value.z())
|
||||||
|
fun to(value: Vector3f) = to(value.x(), value.y(), value.z())
|
||||||
|
|
||||||
|
override fun from(x: Float, y: Float, z: Float): MatteryModelElement {
|
||||||
|
from = Vector3f(x, y, z)
|
||||||
|
super.from(x, y, z)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun to(x: Float, y: Float, z: Float): MatteryModelElement {
|
||||||
|
to = Vector3f(x, y, z)
|
||||||
|
super.to(x, y, z)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun offset(x: Float, y: Float, z: Float): MatteryModelElement {
|
||||||
|
from(x + from.x(), y + from.y(), z + from.z())
|
||||||
|
return to(x + to.x(), y + to.y(), z + to.z())
|
||||||
|
}
|
||||||
|
|
||||||
|
fun offset(value: Vector3f) = offset(value.x(), value.y(), value.z())
|
||||||
|
|
||||||
|
fun fromJson(input: JsonObject) {
|
||||||
|
val from = input["from"] as JsonArray
|
||||||
|
val to = input["to"] as JsonArray
|
||||||
|
|
||||||
|
from(from[0].asFloat, from[1].asFloat, from[2].asFloat)
|
||||||
|
to(to[0].asFloat, to[1].asFloat, to[2].asFloat)
|
||||||
|
|
||||||
|
(input["faces"] as? JsonObject)?.let {
|
||||||
|
for ((k, v) in it.entrySet()) {
|
||||||
|
with(face(Direction.valueOf(k.uppercase()))) {
|
||||||
|
check(v is JsonObject) { "Element has invalid face at $k" }
|
||||||
|
|
||||||
|
(v["uv"] as? JsonArray)?.let { uv ->
|
||||||
|
check(uv.size() == 4) { "Element at $k has invalid number of uvs ${uv.size()}" }
|
||||||
|
uvs(uv[0].asFloat, uv[1].asFloat, uv[2].asFloat, uv[3].asFloat)
|
||||||
|
}
|
||||||
|
|
||||||
|
(v["texture"] as? JsonPrimitive)?.let {
|
||||||
|
texture(it.asString)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,94 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.datagen.models
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject
|
||||||
|
import com.google.gson.JsonParser
|
||||||
|
import net.minecraft.resources.ResourceLocation
|
||||||
|
import net.minecraft.server.packs.PackType
|
||||||
|
import net.minecraft.world.level.block.Block
|
||||||
|
import net.minecraftforge.client.model.generators.ModelProvider
|
||||||
|
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent
|
||||||
|
import ru.dbotthepony.mc.otm.datagen.DataGen
|
||||||
|
|
||||||
|
private typealias Callback = () -> Unit
|
||||||
|
|
||||||
|
sealed class MatteryModelProvider(event: GatherDataEvent, folder: String) : ModelProvider<MatteryModelBuilder>(event.generator, DataGen.MOD_ID, folder, ::MatteryModelBuilder, event.existingFileHelper) {
|
||||||
|
private fun extendWithFolder(rl: ResourceLocation): ResourceLocation {
|
||||||
|
return if (rl.path.contains("/")) rl else ResourceLocation(rl.namespace, folder + "/" + rl.path)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun copy(destination: String, source: String): MatteryModelBuilder {
|
||||||
|
val destinationLocation = extendWithFolder(if (destination.contains(":")) ResourceLocation(destination) else ResourceLocation(modid, destination))
|
||||||
|
val sourceLocation = extendWithFolder(if (source.contains(":")) ResourceLocation("models/$source.json") else ResourceLocation(modid, "models/$source.json"))
|
||||||
|
|
||||||
|
check(!generatedModels.containsKey(destinationLocation)) { "Model provider already contains model $destinationLocation" }
|
||||||
|
existingFileHelper.trackGenerated(destinationLocation, MODEL)
|
||||||
|
|
||||||
|
return factory.apply(destinationLocation).also {
|
||||||
|
generatedModels[destinationLocation] = it
|
||||||
|
val resource = existingFileHelper.getResource(sourceLocation, PackType.CLIENT_RESOURCES)
|
||||||
|
val stream = resource.inputStream
|
||||||
|
val reader = stream.reader()
|
||||||
|
|
||||||
|
try {
|
||||||
|
it.fromJson(JsonParser.parseReader(reader) as JsonObject)
|
||||||
|
} finally {
|
||||||
|
reader.close()
|
||||||
|
stream.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val callbacks = ArrayList<Callback>()
|
||||||
|
|
||||||
|
fun lambda(callback: Callback) {
|
||||||
|
callbacks.add(callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun registerModels() {
|
||||||
|
callbacks.forEach(Callback::invoke)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private data class CubeAllEntry(val path: String, val texture: ResourceLocation)
|
||||||
|
private data class CubeColumnEntry(val path: String, val end: ResourceLocation, val side: ResourceLocation)
|
||||||
|
|
||||||
|
class BlockMatteryModelProvider(event: GatherDataEvent) : MatteryModelProvider(event, BLOCK_FOLDER) {
|
||||||
|
override fun getName(): String {
|
||||||
|
return "Block Models: $modid"
|
||||||
|
}
|
||||||
|
|
||||||
|
private val cubeAll = ArrayList<CubeAllEntry>()
|
||||||
|
private val cubeColumn = ArrayList<CubeColumnEntry>()
|
||||||
|
|
||||||
|
override fun registerModels() {
|
||||||
|
super.registerModels()
|
||||||
|
|
||||||
|
for ((path, texture) in cubeAll) {
|
||||||
|
cubeAll(path, texture)
|
||||||
|
}
|
||||||
|
|
||||||
|
for ((path, end, side) in cubeColumn) {
|
||||||
|
cubeColumn(path, end, side)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun decorativeCubeAll(vararg blocks: Block) {
|
||||||
|
for (it in blocks) {
|
||||||
|
cubeAll.add(CubeAllEntry(it.registryName!!.path, ResourceLocation("overdrive_that_matters:block/decorative/${it.registryName!!.path}")))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun column(it: Block, end: String, side: String) {
|
||||||
|
cubeColumn.add(CubeColumnEntry(it.registryName!!.path, ResourceLocation(DataGen.MOD_ID, end), ResourceLocation(DataGen.MOD_ID, side)))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun decorativeColumn(it: Block, end: String, side: String) {
|
||||||
|
column(it, "block/decorative/$end", "block/decorative/$side")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun resourceCubeAll(vararg blocks: Block) {
|
||||||
|
for (it in blocks) {
|
||||||
|
cubeAll.add(CubeAllEntry(it.registryName!!.path, ResourceLocation("overdrive_that_matters:block/resource/${it.registryName!!.path}")))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -42,8 +42,6 @@ import ru.dbotthepony.mc.otm.item.*;
|
|||||||
import ru.dbotthepony.mc.otm.menu.*;
|
import ru.dbotthepony.mc.otm.menu.*;
|
||||||
import ru.dbotthepony.mc.otm.client.screen.*;
|
import ru.dbotthepony.mc.otm.client.screen.*;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
public class Registry {
|
public class Registry {
|
||||||
public static final DamageSource DAMAGE_BECOME_ANDROID = new DamageSource("otm_become_android");
|
public static final DamageSource DAMAGE_BECOME_ANDROID = new DamageSource("otm_become_android");
|
||||||
public static final DamageSource DAMAGE_BECOME_HUMANE = new DamageSource("otm_become_humane");
|
public static final DamageSource DAMAGE_BECOME_HUMANE = new DamageSource("otm_become_humane");
|
||||||
@ -394,6 +392,7 @@ public class Registry {
|
|||||||
|
|
||||||
public static final Item TRITANIUM_ORE_CLUMP = new Item(new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
|
public static final Item TRITANIUM_ORE_CLUMP = new Item(new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
|
||||||
public static final Item TRITANIUM_INGOT = new Item(new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
|
public static final Item TRITANIUM_INGOT = new Item(new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
|
||||||
|
|
||||||
public static final Item MATTER_IO_PORT = new Item(new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
|
public static final Item MATTER_IO_PORT = new Item(new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
|
||||||
public static final Item MATTER_TRANSFORM_MATRIX = new Item(new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
|
public static final Item MATTER_TRANSFORM_MATRIX = new Item(new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
|
||||||
public static final Item ENERGY_BUS = new Item(new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
|
public static final Item ENERGY_BUS = new Item(new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
|
||||||
@ -423,7 +422,29 @@ public class Registry {
|
|||||||
public static final ItemBattery BATTERY_CAPACITOR = new ItemBattery(new Fraction(150_000), new Fraction(15000), new Fraction(15000));
|
public static final ItemBattery BATTERY_CAPACITOR = new ItemBattery(new Fraction(150_000), new Fraction(15000), new Fraction(15000));
|
||||||
public static final ItemBattery BATTERY_CREATIVE = new ItemBattery();
|
public static final ItemBattery BATTERY_CREATIVE = new ItemBattery();
|
||||||
|
|
||||||
|
public static final ItemBattery[] BATTERIES = {
|
||||||
|
BATTERY_CRUDE,
|
||||||
|
BATTERY_BASIC,
|
||||||
|
BATTERY_NORMAL,
|
||||||
|
BATTERY_DENSE,
|
||||||
|
BATTERY_CAPACITOR,
|
||||||
|
};
|
||||||
|
|
||||||
public static final Item MATTER_CAPACITOR_PARTS = new Item(new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
|
public static final Item MATTER_CAPACITOR_PARTS = new Item(new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
|
||||||
|
|
||||||
|
public static final Item[] DATAGEN_COMPONENTS = {
|
||||||
|
ENERGY_BUS,
|
||||||
|
ELECTRIC_PARTS,
|
||||||
|
TRITANIUM_PLATE,
|
||||||
|
IRON_PLATE,
|
||||||
|
COPPER_WIRING,
|
||||||
|
GOLD_WIRING,
|
||||||
|
CIRCUIT_PLATING,
|
||||||
|
BASIC_CONTROL_CIRCUIT,
|
||||||
|
ADVANCED_CONTROL_CIRCUIT,
|
||||||
|
MATTER_CAPACITOR_PARTS,
|
||||||
|
};
|
||||||
|
|
||||||
public static final ItemMatterCapacitor MATTER_CAPACITOR_BASIC = new ItemMatterCapacitor(new Fraction("4"));
|
public static final ItemMatterCapacitor MATTER_CAPACITOR_BASIC = new ItemMatterCapacitor(new Fraction("4"));
|
||||||
public static final ItemMatterCapacitor MATTER_CAPACITOR_NORMAL = new ItemMatterCapacitor(new Fraction("10"));
|
public static final ItemMatterCapacitor MATTER_CAPACITOR_NORMAL = new ItemMatterCapacitor(new Fraction("10"));
|
||||||
public static final ItemMatterCapacitor MATTER_CAPACITOR_DENSE = new ItemMatterCapacitor(new Fraction("40"));
|
public static final ItemMatterCapacitor MATTER_CAPACITOR_DENSE = new ItemMatterCapacitor(new Fraction("40"));
|
||||||
|
201
src/main/java/ru/dbotthepony/mc/otm/shapes/BlockShapes.java
Normal file
201
src/main/java/ru/dbotthepony/mc/otm/shapes/BlockShapes.java
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.shapes;
|
||||||
|
|
||||||
|
|
||||||
|
// This file is regenerated on each gradle run. Do not edit it!
|
||||||
|
public class BlockShapes {
|
||||||
|
public static final BlockShape ANDROID_STATION = new BlockShape(
|
||||||
|
new SimpleCuboid(0d, 0.4375d, 0d, 1d, 0.5625d, 1d),
|
||||||
|
new SimpleCuboid(0d, 0d, 0d, 1d, 0.25d, 1d),
|
||||||
|
new SimpleCuboid(0.125d, 0.25d, 0.125d, 0.875d, 0.4375d, 0.875d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.25d, 0.8125d, 0.1875d, 0.4375d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.8125d, 0.25d, 0.8125d, 0.9375d, 0.4375d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.8125d, 0.25d, 0.0625d, 0.9375d, 0.4375d, 0.1875d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.25d, 0.0625d, 0.1875d, 0.4375d, 0.1875d)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final BlockShape BATTERY_BANK = new BlockShape(
|
||||||
|
new SimpleCuboid(0.875d, 0d, 0d, 1d, 0.125d, 1d),
|
||||||
|
new SimpleCuboid(0d, 0d, 0d, 0.125d, 0.125d, 1d),
|
||||||
|
new SimpleCuboid(0.125d, 0d, 0d, 0.875d, 0.125d, 0.125d),
|
||||||
|
new SimpleCuboid(0.125d, 0d, 0.875d, 0.875d, 0.125d, 1d),
|
||||||
|
new SimpleCuboid(0.125d, 0.875d, 0d, 0.875d, 1d, 0.125d),
|
||||||
|
new SimpleCuboid(0d, 0.875d, 0d, 0.125d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.125d, 0.875d, 0.875d, 0.875d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.875d, 0.875d, 0d, 1d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.875d, 0.125d, 0.875d, 1d, 0.875d, 1d),
|
||||||
|
new SimpleCuboid(0d, 0.125d, 0.875d, 0.125d, 0.875d, 1d),
|
||||||
|
new SimpleCuboid(0.875d, 0.125d, 0d, 1d, 0.875d, 0.125d),
|
||||||
|
new SimpleCuboid(0d, 0.125d, 0d, 0.125d, 0.875d, 0.125d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.0625d, 0.4375d, 0.9375d, 0.9375d, 0.5625d)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final BlockShape BLACK_HOLE = new BlockShape(
|
||||||
|
new SimpleCuboid(0.5d, 0.46875d, 0.5d, 0.515625d, 0.484375d, 0.515625d),
|
||||||
|
new SimpleCuboid(0.484375d, 0.484375d, 0.484375d, 0.5d, 0.5d, 0.5d),
|
||||||
|
new SimpleCuboid(0.484375d, 0.484375d, 0.5d, 0.5d, 0.5d, 0.515625d),
|
||||||
|
new SimpleCuboid(0.484375d, 0.484375d, 0.515625d, 0.5d, 0.5d, 0.53125d),
|
||||||
|
new SimpleCuboid(0.5d, 0.484375d, 0.484375d, 0.515625d, 0.5d, 0.5d),
|
||||||
|
new SimpleCuboid(0.5d, 0.484375d, 0.5d, 0.515625d, 0.5d, 0.515625d),
|
||||||
|
new SimpleCuboid(0.5d, 0.484375d, 0.515625d, 0.515625d, 0.5d, 0.53125d),
|
||||||
|
new SimpleCuboid(0.515625d, 0.484375d, 0.484375d, 0.53125d, 0.5d, 0.5d),
|
||||||
|
new SimpleCuboid(0.515625d, 0.484375d, 0.5d, 0.53125d, 0.5d, 0.515625d),
|
||||||
|
new SimpleCuboid(0.515625d, 0.484375d, 0.515625d, 0.53125d, 0.5d, 0.53125d),
|
||||||
|
new SimpleCuboid(0.46875d, 0.5d, 0.5d, 0.484375d, 0.515625d, 0.515625d),
|
||||||
|
new SimpleCuboid(0.484375d, 0.5d, 0.484375d, 0.5d, 0.515625d, 0.5d),
|
||||||
|
new SimpleCuboid(0.484375d, 0.5d, 0.5d, 0.5d, 0.515625d, 0.515625d),
|
||||||
|
new SimpleCuboid(0.484375d, 0.5d, 0.515625d, 0.5d, 0.515625d, 0.53125d),
|
||||||
|
new SimpleCuboid(0.5d, 0.5d, 0.46875d, 0.515625d, 0.515625d, 0.484375d),
|
||||||
|
new SimpleCuboid(0.5d, 0.5d, 0.484375d, 0.515625d, 0.515625d, 0.5d),
|
||||||
|
new SimpleCuboid(0.5d, 0.5d, 0.5d, 0.515625d, 0.515625d, 0.515625d),
|
||||||
|
new SimpleCuboid(0.5d, 0.5d, 0.515625d, 0.515625d, 0.515625d, 0.53125d),
|
||||||
|
new SimpleCuboid(0.5d, 0.5d, 0.53125d, 0.515625d, 0.515625d, 0.546875d),
|
||||||
|
new SimpleCuboid(0.515625d, 0.5d, 0.484375d, 0.53125d, 0.515625d, 0.5d),
|
||||||
|
new SimpleCuboid(0.515625d, 0.5d, 0.5d, 0.53125d, 0.515625d, 0.515625d),
|
||||||
|
new SimpleCuboid(0.515625d, 0.5d, 0.515625d, 0.53125d, 0.515625d, 0.53125d),
|
||||||
|
new SimpleCuboid(0.53125d, 0.5d, 0.5d, 0.546875d, 0.515625d, 0.515625d),
|
||||||
|
new SimpleCuboid(0.484375d, 0.515625d, 0.484375d, 0.5d, 0.53125d, 0.5d),
|
||||||
|
new SimpleCuboid(0.484375d, 0.515625d, 0.5d, 0.5d, 0.53125d, 0.515625d),
|
||||||
|
new SimpleCuboid(0.484375d, 0.515625d, 0.515625d, 0.5d, 0.53125d, 0.53125d),
|
||||||
|
new SimpleCuboid(0.5d, 0.515625d, 0.484375d, 0.515625d, 0.53125d, 0.5d),
|
||||||
|
new SimpleCuboid(0.5d, 0.515625d, 0.5d, 0.515625d, 0.53125d, 0.515625d),
|
||||||
|
new SimpleCuboid(0.5d, 0.515625d, 0.515625d, 0.515625d, 0.53125d, 0.53125d),
|
||||||
|
new SimpleCuboid(0.515625d, 0.515625d, 0.484375d, 0.53125d, 0.53125d, 0.5d),
|
||||||
|
new SimpleCuboid(0.515625d, 0.515625d, 0.5d, 0.53125d, 0.53125d, 0.515625d),
|
||||||
|
new SimpleCuboid(0.515625d, 0.515625d, 0.515625d, 0.53125d, 0.53125d, 0.53125d),
|
||||||
|
new SimpleCuboid(0.5d, 0.53125d, 0.5d, 0.515625d, 0.546875d, 0.515625d)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final BlockShape MATTER_SCANNER = new BlockShape(
|
||||||
|
new SimpleCuboid(0d, 0.25d, 0d, 1d, 0.5d, 1d),
|
||||||
|
new SimpleCuboid(0d, 0d, 0d, 1d, 0.125d, 1d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.125d, 0.0625d, 0.9375d, 0.25d, 0.9375d),
|
||||||
|
new SimpleCuboid(0d, 0.875d, 0.0625d, 0.0625d, 0.9375d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.9375d, 0.5d, 0d, 1d, 1d, 0.0625d),
|
||||||
|
new SimpleCuboid(0d, 0.5d, 0d, 0.0625d, 1d, 0.0625d),
|
||||||
|
new SimpleCuboid(0d, 0.5d, 0.9375d, 0.0625d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.9375d, 0.5d, 0.9375d, 1d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.9375d, 0.875d, 0.0625d, 1d, 0.9375d, 0.9375d),
|
||||||
|
new SimpleCuboid(0d, 0.8125d, 0.6875d, 0.125d, 0.875d, 0.8125d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.875d, 0.6875d, 0.125d, 0.9375d, 0.8125d),
|
||||||
|
new SimpleCuboid(0.875d, 0.875d, 0.6875d, 0.9375d, 0.9375d, 0.8125d),
|
||||||
|
new SimpleCuboid(0.875d, 0.8125d, 0.6875d, 1d, 0.875d, 0.8125d),
|
||||||
|
new SimpleCuboid(0.125d, 0.875d, 0.6875d, 0.875d, 0.90625d, 0.8125d),
|
||||||
|
new SimpleCuboid(0.1875d, 0.8125d, 0.5625d, 0.375d, 0.9375d, 0.875d)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final BlockShape PATTERN_STORAGE = new BlockShape(
|
||||||
|
new SimpleCuboid(0d, 0d, 0d, 1d, 0.125d, 1d),
|
||||||
|
new SimpleCuboid(0.875d, 0.125d, 0.875d, 1d, 0.875d, 1d),
|
||||||
|
new SimpleCuboid(0.875d, 0.9375d, 0d, 1d, 1d, 0.75d),
|
||||||
|
new SimpleCuboid(0d, 0.9375d, 0d, 0.125d, 1d, 0.75d),
|
||||||
|
new SimpleCuboid(0d, 0.125d, 0.875d, 0.125d, 0.875d, 1d),
|
||||||
|
new SimpleCuboid(0d, 0.125d, 0.625d, 1d, 0.3125d, 0.75d),
|
||||||
|
new SimpleCuboid(0d, 0.125d, 0d, 1d, 0.1875d, 0.0625d),
|
||||||
|
new SimpleCuboid(0d, 0.875d, 0d, 1d, 0.9375d, 0.0625d),
|
||||||
|
new SimpleCuboid(0d, 0.875d, 0.75d, 1d, 1d, 1d)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final BlockShape MATTER_REPLICATOR = new BlockShape(
|
||||||
|
new SimpleCuboid(0.9375d, 0d, 0d, 1d, 0.6875d, 1d),
|
||||||
|
new SimpleCuboid(0d, 0d, 0d, 0.0625d, 0.6875d, 1d),
|
||||||
|
new SimpleCuboid(0d, 0.6875d, 0.0625d, 0.5d, 1d, 0.375d),
|
||||||
|
new SimpleCuboid(0.5d, 0.6875d, 0d, 1d, 1d, 0.375d),
|
||||||
|
new SimpleCuboid(0.1875d, 0.6875d, 0.6875d, 0.9375d, 0.9375d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.1875d, 0.6875d, 0.375d, 0.9375d, 0.9375d, 0.625d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.6875d, 0.4375d, 0.1875d, 0.875d, 0.5625d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.6875d, 0.75d, 0.1875d, 0.875d, 0.875d),
|
||||||
|
new SimpleCuboid(0d, 0.6875d, 0.9375d, 0.03125d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.96875d, 0.6875d, 0.9375d, 1d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.96875d, 0.9375d, 0.375d, 1d, 1d, 0.9375d),
|
||||||
|
new SimpleCuboid(0d, 0.9375d, 0.375d, 0.03125d, 1d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.0625d, 0d, 0d, 0.9375d, 0.0625d, 1d),
|
||||||
|
new SimpleCuboid(0.5d, 0.4375d, 0d, 0.9375d, 0.6875d, 0.0625d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.5625d, 0d, 0.5d, 0.6875d, 0.0625d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.0625d, 0d, 0.125d, 0.5625d, 0.0625d),
|
||||||
|
new SimpleCuboid(0.875d, 0.0625d, 0d, 0.9375d, 0.4375d, 0.0625d),
|
||||||
|
new SimpleCuboid(0.125d, 0.0625d, 0d, 0.875d, 0.125d, 0.0625d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.625d, 0.0625d, 0.9375d, 0.6875d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.0625d, 0.9375d, 0.9375d, 0.6875d, 1d),
|
||||||
|
new SimpleCuboid(0.1875d, 0.0625d, 0.1875d, 0.8125d, 0.125d, 0.8125d)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final BlockShape MATTER_DECOMPOSER = new BlockShape(
|
||||||
|
new SimpleCuboid(0d, 0d, 0d, 1d, 0.1875d, 1d),
|
||||||
|
new SimpleCuboid(0.5d, 0.1875d, 0d, 1d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.1875d, 0.0625d, 0.4375d, 0.875d, 0.4375d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.1875d, 0.5625d, 0.4375d, 0.875d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.1875d, 0.8125d, 0.6875d, 0.5d, 0.9375d, 0.8125d),
|
||||||
|
new SimpleCuboid(0.1875d, 0.8125d, 0.1875d, 0.5d, 0.9375d, 0.3125d)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final BlockShape CHEMICAL_GENERATOR = new BlockShape(
|
||||||
|
new SimpleCuboid(0d, 0d, 0d, 1d, 0.125d, 0.125d),
|
||||||
|
new SimpleCuboid(0.1875d, 0.0625d, 0.125d, 0.3125d, 0.125d, 0.875d),
|
||||||
|
new SimpleCuboid(0.6875d, 0.0625d, 0.125d, 0.8125d, 0.125d, 0.875d),
|
||||||
|
new SimpleCuboid(0d, 0d, 0.875d, 1d, 0.125d, 1d),
|
||||||
|
new SimpleCuboid(0.875d, 0.125d, 0.875d, 1d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.875d, 0.875d, 0.125d, 1d, 1d, 0.875d),
|
||||||
|
new SimpleCuboid(0.875d, 0.125d, 0d, 1d, 1d, 0.125d),
|
||||||
|
new SimpleCuboid(0d, 0.125d, 0.875d, 0.125d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0d, 0.875d, 0.125d, 0.125d, 1d, 0.875d),
|
||||||
|
new SimpleCuboid(0.125d, 0.3125d, 0.0625d, 0.875d, 0.4375d, 0.125d),
|
||||||
|
new SimpleCuboid(0.125d, 0.3125d, 0.875d, 0.875d, 0.4375d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.5d, 0.125d, 0.125d, 0.625d, 0.875d),
|
||||||
|
new SimpleCuboid(0.875d, 0.5d, 0.125d, 0.9375d, 0.625d, 0.875d),
|
||||||
|
new SimpleCuboid(0d, 0.125d, 0d, 0.125d, 1d, 0.125d),
|
||||||
|
new SimpleCuboid(0d, 0.125d, 0.1875d, 1d, 0.5d, 0.5625d),
|
||||||
|
new SimpleCuboid(0d, 0.125d, 0.625d, 0.125d, 0.5d, 0.8125d),
|
||||||
|
new SimpleCuboid(0.5d, 0.125d, 0.625d, 1d, 0.5d, 0.875d),
|
||||||
|
new SimpleCuboid(0.1875d, 0.25d, 0.6875d, 0.4375d, 0.5d, 0.8125d),
|
||||||
|
new SimpleCuboid(0.125d, 0.5d, 0.0625d, 0.875d, 0.9375d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.125d, 0.1875d, 0.5625d, 0.875d, 0.5d, 0.6875d)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final BlockShape MATTER_BOTTLER = new BlockShape(
|
||||||
|
new SimpleCuboid(0d, 0d, 0d, 1d, 0.625d, 0.75d),
|
||||||
|
new SimpleCuboid(0.625d, 0.625d, 0.125d, 1d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0d, 0.625d, 0.4375d, 0.625d, 1d, 0.75d),
|
||||||
|
new SimpleCuboid(0d, 0.625d, 0d, 0.625d, 0.6875d, 0.4375d),
|
||||||
|
new SimpleCuboid(0d, 0d, 0.75d, 1d, 0.5d, 1d),
|
||||||
|
new SimpleCuboid(0.625d, 0.5d, 0.75d, 1d, 0.625d, 1d),
|
||||||
|
new SimpleCuboid(0.125d, 0.75d, 0.75d, 0.625d, 0.9375d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.125d, 0.5d, 0.75d, 0.625d, 0.6875d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.8125d, 0.75d, 0.125d, 0.875d, 0.875d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.5625d, 0.75d, 0.125d, 0.625d, 0.875d),
|
||||||
|
new SimpleCuboid(0d, 0.5d, 0.9375d, 0.0625d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0d, 0.6875d, 0.75d, 0.03125d, 0.75d, 0.9375d),
|
||||||
|
new SimpleCuboid(0d, 0.9375d, 0.75d, 0.03125d, 1d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.6875d, 0.96875d, 0.625d, 0.75d, 1d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.9375d, 0.96875d, 0.625d, 1d, 1d)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final BlockShape DRIVE_RACK = new BlockShape(
|
||||||
|
new SimpleCuboid(0.875d, 0d, 0d, 1d, 0.125d, 1d),
|
||||||
|
new SimpleCuboid(0d, 0d, 0d, 0.125d, 0.125d, 1d),
|
||||||
|
new SimpleCuboid(0.125d, 0d, 0d, 0.875d, 0.125d, 0.125d),
|
||||||
|
new SimpleCuboid(0.125d, 0d, 0.875d, 0.875d, 0.125d, 1d),
|
||||||
|
new SimpleCuboid(0.125d, 0.875d, 0d, 0.875d, 1d, 0.125d),
|
||||||
|
new SimpleCuboid(0d, 0.875d, 0d, 0.125d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.125d, 0.875d, 0.875d, 0.875d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.875d, 0.875d, 0d, 1d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.875d, 0.125d, 0.875d, 1d, 0.875d, 1d),
|
||||||
|
new SimpleCuboid(0d, 0.125d, 0.875d, 0.125d, 0.875d, 1d),
|
||||||
|
new SimpleCuboid(0.875d, 0.125d, 0d, 1d, 0.875d, 0.125d),
|
||||||
|
new SimpleCuboid(0d, 0.125d, 0d, 0.125d, 0.875d, 0.125d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.0625d, 0.0625d, 0.9375d, 0.9375d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.1625d, 0.375d, 0.01875d, 0.4125d, 0.625d, 0.08125d)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final BlockShape ITEM_MONITOR = new BlockShape(
|
||||||
|
new SimpleCuboid(0d, 0d, 0.0625d, 1d, 1d, 0.4375d),
|
||||||
|
new SimpleCuboid(0d, 0d, 0.4375d, 0.125d, 0.125d, 1d),
|
||||||
|
new SimpleCuboid(0d, 0.875d, 0.4375d, 0.125d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.875d, 0.875d, 0.4375d, 1d, 1d, 1d),
|
||||||
|
new SimpleCuboid(0.875d, 0d, 0.4375d, 1d, 0.125d, 1d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.125d, 0.8125d, 0.125d, 0.875d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.0625d, 0.125d, 0.5d, 0.125d, 0.875d, 0.625d),
|
||||||
|
new SimpleCuboid(0.875d, 0.125d, 0.8125d, 0.9375d, 0.875d, 0.9375d),
|
||||||
|
new SimpleCuboid(0.875d, 0.125d, 0.5d, 0.9375d, 0.875d, 0.625d)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
@ -38,7 +38,7 @@ class BlockChemicalGenerator : BlockMatteryRotatable(), EntityBlock {
|
|||||||
|
|
||||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||||
super.createBlockStateDefinition(builder)
|
super.createBlockStateDefinition(builder)
|
||||||
builder.add(WorkerState.WORKER_STATE)
|
builder.add(WorkerState.SEMI_WORKER_STATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun neighborChanged(
|
override fun neighborChanged(
|
||||||
|
@ -213,11 +213,11 @@ class BlockEntityChemicalGenerator(pos: BlockPos, state: BlockState) : BlockEnti
|
|||||||
check = true
|
check = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockState.getValue(WorkerState.WORKER_STATE) != WorkerState.WORKING) {
|
if (blockState.getValue(WorkerState.SEMI_WORKER_STATE) != WorkerState.WORKING) {
|
||||||
level?.setBlock(blockPos, blockState.setValue(WorkerState.WORKER_STATE, WorkerState.WORKING), Block.UPDATE_CLIENTS)
|
level?.setBlock(blockPos, blockState.setValue(WorkerState.SEMI_WORKER_STATE, WorkerState.WORKING), Block.UPDATE_CLIENTS)
|
||||||
}
|
}
|
||||||
} else if (blockState.getValue(WorkerState.WORKER_STATE) != WorkerState.IDLE) {
|
} else if (blockState.getValue(WorkerState.SEMI_WORKER_STATE) != WorkerState.IDLE) {
|
||||||
level?.setBlock(blockPos, blockState.setValue(WorkerState.WORKER_STATE, WorkerState.IDLE), Block.UPDATE_CLIENTS)
|
level?.setBlock(blockPos, blockState.setValue(WorkerState.SEMI_WORKER_STATE, WorkerState.IDLE), Block.UPDATE_CLIENTS)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (workingTicks == 0 && !isBlockedByRedstone && check) {
|
if (workingTicks == 0 && !isBlockedByRedstone && check) {
|
||||||
|
@ -238,7 +238,7 @@ private fun magnitude(value: BigInteger): MagnitudeCrunchResult {
|
|||||||
|
|
||||||
@JvmRecord
|
@JvmRecord
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
data class Fraction @JvmOverloads constructor(@JvmField val value: BigInteger, @JvmField val divisor: BigInteger = BigInteger.ONE, @JvmField val compact: Boolean = true) {
|
data class Fraction @JvmOverloads constructor(@JvmField val value: BigInteger, @JvmField val divisor: BigInteger = BigInteger.ONE, @JvmField val compact: Boolean = true) : Comparable<Fraction> {
|
||||||
@JvmOverloads constructor(value: Long, compact: Boolean = true) : this(BigInteger.valueOf(value), compact = compact)
|
@JvmOverloads constructor(value: Long, compact: Boolean = true) : this(BigInteger.valueOf(value), compact = compact)
|
||||||
@JvmOverloads constructor(value: Int, compact: Boolean = true) : this(BigInteger.valueOf(value.toLong()), compact = compact)
|
@JvmOverloads constructor(value: Int, compact: Boolean = true) : this(BigInteger.valueOf(value.toLong()), compact = compact)
|
||||||
@JvmOverloads constructor(value: Float, compact: Boolean = true) : this(BigDecimal(value.toString()), compact = compact)
|
@JvmOverloads constructor(value: Float, compact: Boolean = true) : this(BigDecimal(value.toString()), compact = compact)
|
||||||
@ -349,7 +349,7 @@ data class Fraction @JvmOverloads constructor(@JvmField val value: BigInteger, @
|
|||||||
return a.value == b.value && a.divisor == b.divisor
|
return a.value == b.value && a.divisor == b.divisor
|
||||||
}
|
}
|
||||||
|
|
||||||
operator fun compareTo(other: Fraction): Int {
|
override operator fun compareTo(other: Fraction): Int {
|
||||||
if (isNaN() || other.isNaN()) return 0
|
if (isNaN() || other.isNaN()) return 0
|
||||||
|
|
||||||
if (divisor == other.divisor)
|
if (divisor == other.divisor)
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
/deepslate_tritanium_ore.json
|
|
||||||
/tritanium_ore.json
|
|
||||||
/tritanium_raw_block.json
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"variants": {
|
|
||||||
"": {
|
|
||||||
"model": "overdrive_that_matters:block/android_station"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=north,open=true": {
|
||||||
|
"model": "overdrive_that_matters:block/cargo_crate_open",
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"facing=north,open=false": {
|
||||||
|
"model": "overdrive_that_matters:block/cargo_crate_closed",
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"facing=south,open=true": {
|
||||||
|
"model": "overdrive_that_matters:block/cargo_crate_open",
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=south,open=false": {
|
||||||
|
"model": "overdrive_that_matters:block/cargo_crate_closed",
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=west,open=true": {
|
||||||
|
"model": "overdrive_that_matters:block/cargo_crate_open",
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"facing=west,open=false": {
|
||||||
|
"model": "overdrive_that_matters:block/cargo_crate_closed",
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"facing=east,open=true": {
|
||||||
|
"model": "overdrive_that_matters:block/cargo_crate_open",
|
||||||
|
"y": 90
|
||||||
|
},
|
||||||
|
"facing=east,open=false": {
|
||||||
|
"model": "overdrive_that_matters:block/cargo_crate_closed",
|
||||||
|
"y": 90
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,121 +0,0 @@
|
|||||||
{
|
|
||||||
"multipart": [
|
|
||||||
{
|
|
||||||
"when": {
|
|
||||||
"facing": "north",
|
|
||||||
"worker": "idle"
|
|
||||||
},
|
|
||||||
"apply": {
|
|
||||||
"model": "overdrive_that_matters:block/chemical_generator_idle"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": {
|
|
||||||
"facing": "north",
|
|
||||||
"worker": "working"
|
|
||||||
},
|
|
||||||
"apply": {
|
|
||||||
"model": "overdrive_that_matters:block/chemical_generator_working"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": {
|
|
||||||
"facing": "north",
|
|
||||||
"worker": "error"
|
|
||||||
},
|
|
||||||
"apply": {
|
|
||||||
"model": "overdrive_that_matters:block/chemical_generator_error"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": {
|
|
||||||
"facing": "south",
|
|
||||||
"worker": "idle"
|
|
||||||
},
|
|
||||||
"apply": {
|
|
||||||
"model": "overdrive_that_matters:block/chemical_generator_idle",
|
|
||||||
"y": 180
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": {
|
|
||||||
"facing": "south",
|
|
||||||
"worker": "working"
|
|
||||||
},
|
|
||||||
"apply": {
|
|
||||||
"model": "overdrive_that_matters:block/chemical_generator_working",
|
|
||||||
"y": 180
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": {
|
|
||||||
"facing": "south",
|
|
||||||
"worker": "error"
|
|
||||||
},
|
|
||||||
"apply": {
|
|
||||||
"model": "overdrive_that_matters:block/chemical_generator_error",
|
|
||||||
"y": 180
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": {
|
|
||||||
"facing": "west",
|
|
||||||
"worker": "idle"
|
|
||||||
},
|
|
||||||
"apply": {
|
|
||||||
"model": "overdrive_that_matters:block/chemical_generator_idle",
|
|
||||||
"y": 270
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": {
|
|
||||||
"facing": "west",
|
|
||||||
"worker": "working"
|
|
||||||
},
|
|
||||||
"apply": {
|
|
||||||
"model": "overdrive_that_matters:block/chemical_generator_working",
|
|
||||||
"y": 270
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": {
|
|
||||||
"facing": "west",
|
|
||||||
"worker": "error"
|
|
||||||
},
|
|
||||||
"apply": {
|
|
||||||
"model": "overdrive_that_matters:block/chemical_generator_error",
|
|
||||||
"y": 270
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": {
|
|
||||||
"facing": "east",
|
|
||||||
"worker": "idle"
|
|
||||||
},
|
|
||||||
"apply": {
|
|
||||||
"model": "overdrive_that_matters:block/chemical_generator_idle",
|
|
||||||
"y": 90
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": {
|
|
||||||
"facing": "east",
|
|
||||||
"worker": "working"
|
|
||||||
},
|
|
||||||
"apply": {
|
|
||||||
"model": "overdrive_that_matters:block/chemical_generator_working",
|
|
||||||
"y": 90
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": {
|
|
||||||
"facing": "east",
|
|
||||||
"worker": "error"
|
|
||||||
},
|
|
||||||
"apply": {
|
|
||||||
"model": "overdrive_that_matters:block/chemical_generator_error",
|
|
||||||
"y": 90
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"variants": {
|
|
||||||
"facing=south": {
|
|
||||||
"model": "overdrive_that_matters:block/item_monitor",
|
|
||||||
"y": 180
|
|
||||||
},
|
|
||||||
"facing=west": {
|
|
||||||
"model": "overdrive_that_matters:block/item_monitor",
|
|
||||||
"y": 270
|
|
||||||
},
|
|
||||||
"facing=north": {
|
|
||||||
"model": "overdrive_that_matters:block/item_monitor"
|
|
||||||
},
|
|
||||||
"facing=east": {
|
|
||||||
"model": "overdrive_that_matters:block/item_monitor",
|
|
||||||
"y": 90
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
/deepslate_tritanium_ore.json
|
|
||||||
/tritanium_ore.json
|
|
||||||
/tritanium_raw_block.json
|
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "block/cube_column",
|
|
||||||
"textures": {
|
|
||||||
"end": "overdrive_that_matters:block/decorative/tritanium_block",
|
|
||||||
"side": "overdrive_that_matters:block/decorative/tritanium_striped_block"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "overdrive_that_matters:block/android_station"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "overdrive_that_matters:block/battery_bank"
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/battery_tier1"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/battery_tier4"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/battery_creative"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/battery_tier0"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/battery_tier3"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/battery_tier2"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "overdrive_that_matters:block/cargo_crate_closed"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "overdrive_that_matters:block/chemical_generator_working"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "overdrive_that_matters:block/energy_counter_down"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "overdrive_that_matters:block/item_monitor"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "overdrive_that_matters:block/matter_bottler_working"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "overdrive_that_matters:block/matter_cable_core"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "overdrive_that_matters:block/matter_capacitor_bank"
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/matter_capacitor_tier1"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/matter_capacitor_creative"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/matter_capacitor_tier3"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/matter_capacitor_tier2"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/component/matter_capacitor_parts"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "overdrive_that_matters:block/matter_decomposer_working"
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/nutrient_paste"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/pattern_drive_creative"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "overdrive_that_matters:block/pattern_storage"
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/pill_android"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/pill_humane"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "item/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "overdrive_that_matters:item/resources/tritanium_ore_clump"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
/tritanium_raw_block.json
|
|
@ -183,7 +183,7 @@ object FractionTests {
|
|||||||
blackHole[i] = blackHole[rand.nextInt(size)]
|
blackHole[i] = blackHole[rand.nextInt(size)]
|
||||||
}
|
}
|
||||||
|
|
||||||
val blackHole2 = arrayOfNulls<Double>(100_000)
|
val blackHole2 = Array(100_000) {0.0}
|
||||||
time = System.currentTimeMillis()
|
time = System.currentTimeMillis()
|
||||||
|
|
||||||
for (i in 0 until 100_000) {
|
for (i in 0 until 100_000) {
|
||||||
|
Loading…
Reference in New Issue
Block a user