Add auto generated pattern storage models and blockstate

This commit is contained in:
DBotThePony 2021-08-18 17:21:26 +07:00
parent 1b8f3a5030
commit b929dcdb3a
Signed by: DBot
GPG Key ID: DCC23B5715498507
6 changed files with 93 additions and 118 deletions

7
.gitignore vendored
View File

@ -23,3 +23,10 @@ run
# 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

View File

@ -1,3 +1,4 @@
buildscript { buildscript {
repositories { repositories {
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below // These repositories are only for Gradle plugins, put any other repositories in the repository block further below
@ -8,6 +9,7 @@ buildscript {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
} }
} }
apply plugin: 'net.minecraftforge.gradle' apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse' apply plugin: 'eclipse'
@ -56,7 +58,7 @@ minecraft {
property 'forge.logging.console.level', 'debug' property 'forge.logging.console.level', 'debug'
mods { mods {
examplemod { overdrive_that_matters {
source sourceSets.main source sourceSets.main
} }
} }
@ -78,7 +80,7 @@ minecraft {
property 'forge.logging.console.level', 'debug' property 'forge.logging.console.level', 'debug'
mods { mods {
examplemod { overdrive_that_matters {
source sourceSets.main source sourceSets.main
} }
} }
@ -103,7 +105,7 @@ minecraft {
args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods { mods {
examplemod { overdrive_that_matters {
source sourceSets.main source sourceSets.main
} }
} }

View File

@ -10,7 +10,8 @@ const models = [
]; ];
const fs = require('fs') const fs = require('fs')
const root = './src/main/resources/assets/overdrive_that_matters/models/block/' const _root = './src/main/resources/assets/overdrive_that_matters/'
const root = _root + 'models/block/'
const handle = fs.openSync('./src/main/java/ru/dbotthepony/mc/otm/shapes/BlockShapes.java', 'w') const handle = fs.openSync('./src/main/java/ru/dbotthepony/mc/otm/shapes/BlockShapes.java', 'w')
@ -47,3 +48,62 @@ for (const model of models) {
fs.writeSync(handle, '}') fs.writeSync(handle, '}')
fs.closeSync(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'))
}

View File

@ -1,95 +0,0 @@
package ru.dbotthepony.mc.otm.shapes;
// Auto generated at Wed, 18 Aug 2021 07:55:20 GMT
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 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.875d, 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, 0d, 1d, 1d),
new SimpleCuboid(1d, 0.6875d, 0.9375d, 1d, 1d, 1d),
new SimpleCuboid(1d, 0.9375d, 0.375d, 1d, 1d, 0.9375d),
new SimpleCuboid(0d, 0.9375d, 0.375d, 0d, 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)
);
}

View File

@ -1,19 +0,0 @@
{
"variants": {
"facing=south": {
"model": "overdrive_that_matters:block/pattern_storage",
"y": 180
},
"facing=west": {
"model": "overdrive_that_matters:block/pattern_storage",
"y": 270
},
"facing=north": {
"model": "overdrive_that_matters:block/pattern_storage"
},
"facing=east": {
"model": "overdrive_that_matters:block/pattern_storage",
"y": 90
}
}
}

View File

@ -0,0 +1,20 @@
{
"texture_size": [32, 32],
"textures": {
"texture": "overdrive_that_matters:item/pattern_drive_tier0"
},
"elements": [
{
"from": [15, 2, 2],
"to": [15.3, 14, 14],
"faces": {
"north": {"uv": [1, 1, 2, 15], "texture": "#texture"},
"east": {"uv": [15, 1, 1, 15], "texture": "#texture"},
"south": {"uv": [14, 1, 15, 15], "texture": "#texture"},
"west": {"uv": [1, 1, 15, 15], "texture": "#texture"},
"up": {"uv": [1, 1, 15, 2], "rotation": 90, "texture": "#texture"},
"down": {"uv": [1, 14, 15, 15], "texture": "#texture"}
}
}
]
}