-
-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
Hi! I'm using a very similar to your mcmeta lib for rendering blocks in my client that also provides assets but is published to npm (mc-assets). I also have these special render models but extracted into json instead (mainly copied from bluemap) but of course I would be happy to not maintain them and instead copy from some other source instead like yours. I wonder if it would be possible to extract model definitions from
deepslate/src/render/SpecialRenderer.ts
Lines 1 to 100 in e49520f
| import { mat4 } from 'gl-matrix' | |
| import type { BlockState } from '../core/index.js' | |
| import { Direction, Identifier } from '../core/index.js' | |
| import { BlockColors } from './BlockColors.js' | |
| import { BlockModel } from './BlockModel.js' | |
| import { Cull } from './Cull.js' | |
| import { Mesh } from './Mesh.js' | |
| import type { TextureAtlasProvider } from './TextureAtlas.js' | |
| function liquidRenderer(type: string, level: number, atlas: TextureAtlasProvider, cull: Cull, tintindex?: number) { | |
| const y = cull['up'] ? 16 : [14.2, 12.5, 10.5, 9, 7, 5.3, 3.7, 1.9, 16, 16, 16, 16, 16, 16, 16, 16][level] | |
| return new BlockModel(undefined, { | |
| still: `block/${type}_still`, | |
| flow: `block/${type}_flow`, | |
| }, [{ | |
| from: [0, 0, 0], | |
| to: [16, y, 16], | |
| faces: { | |
| up: { texture: '#still', tintindex, cullface: Direction.UP }, | |
| down: { texture: '#still', tintindex, cullface: Direction.DOWN }, | |
| north: { texture: '#flow', tintindex, cullface: Direction.NORTH }, | |
| east: { texture: '#flow', tintindex, cullface: Direction.EAST }, | |
| south: { texture: '#flow', tintindex, cullface: Direction.SOUTH }, | |
| west: { texture: '#flow', tintindex, cullface: Direction.WEST }, | |
| }, | |
| }]).getMesh(atlas, cull, BlockColors[type]?.({})) | |
| } | |
| export namespace SpecialRenderers { | |
| export function chestRenderer(texture: Identifier) { | |
| return (atlas: TextureAtlasProvider) => { | |
| return new BlockModel(undefined, { | |
| 0: texture.withPrefix('entity/chest/').toString(), | |
| }, [ | |
| { | |
| from: [1, 0, 1], | |
| to: [15, 10, 15], | |
| faces: { | |
| north: {uv: [10.5, 8.25, 14, 10.75], rotation: 180, texture: '#0'}, | |
| east: {uv: [7, 8.25, 10.5, 10.75], rotation: 180, texture: '#0'}, | |
| south: {uv: [3.5, 8.25, 7, 10.75], rotation: 180, texture: '#0'}, | |
| west: {uv: [0, 8.25, 3.5, 10.75], rotation: 180, texture: '#0'}, | |
| up: {uv: [7, 4.75, 10.5, 8.25], texture: '#0'}, | |
| down: {uv: [3.5, 4.75, 7, 8.25], texture: '#0'}, | |
| }, | |
| }, | |
| { | |
| from: [1, 10, 1], | |
| to: [15, 14, 15], | |
| faces: { | |
| north: {uv: [10.5, 3.75, 14, 4.75], rotation: 180, texture: '#0'}, | |
| east: {uv: [7, 3.75, 10.5, 4.75], rotation: 180, texture: '#0'}, | |
| south: {uv: [3.5, 3.75, 7, 4.75], rotation: 180, texture: '#0'}, | |
| west: {uv: [0, 3.75, 3.5, 4.75], rotation: 180, texture: '#0'}, | |
| up: {uv: [7, 0, 10.5, 3.5], texture: '#0'}, | |
| down: {uv: [3.5, 0, 7, 3.5], texture: '#0'}, | |
| }, | |
| }, | |
| { | |
| from: [7, 7, 0], | |
| to: [9, 11, 2], | |
| faces: { | |
| north: {uv: [0.25, 0.25, 0.75, 1.25], rotation: 180, texture: '#0'}, | |
| east: {uv: [0, 0.25, 0.25, 1.25], rotation: 180, texture: '#0'}, | |
| south: {uv: [1, 0.25, 1.5, 1.25], rotation: 180, texture: '#0'}, | |
| west: {uv: [0.75, 0.25, 1, 1.25], rotation: 180, texture: '#0'}, | |
| up: {uv: [0.25, 0, 0.75, 0.25], rotation: 180, texture: '#0'}, | |
| down: {uv: [0.75, 0, 1.25, 0.25], rotation: 180, texture: '#0'}, | |
| }, | |
| }, | |
| ]).getMesh(atlas, Cull.none()) | |
| } | |
| } | |
| export function decoratedPotRenderer(atlas: TextureAtlasProvider) { | |
| return new BlockModel(undefined, { | |
| 0: 'entity/decorated_pot/decorated_pot_side', | |
| 1: 'entity/decorated_pot/decorated_pot_base', | |
| }, [ | |
| { | |
| from: [1, 0, 1], | |
| to: [15, 16, 15], | |
| faces: { | |
| north: {uv: [1, 0, 15, 16], texture: '#0'}, | |
| east: {uv: [1, 0, 15, 16], texture: '#0'}, | |
| south: {uv: [1, 0, 15, 16], texture: '#0'}, | |
| west: {uv: [1, 0, 15, 16], texture: '#0'}, | |
| up: {uv: [0, 6.5, 7, 13.5], texture: '#1'}, | |
| down: {uv: [7, 6.5, 14, 13.5], texture: '#1'}, | |
| }, | |
| }, | |
| { | |
| from: [5, 16, 5], | |
| to: [11, 17, 11], | |
| faces: { | |
| north: {uv: [0, 5.5, 3, 6], texture: '#1'}, | |
| east: {uv: [3, 5.5, 6, 6], texture: '#1'}, | |
| south: {uv: [6, 5.5, 9, 6], texture: '#1'}, | |
| west: {uv: [9, 5.5, 12, 6], texture: '#1'}, |
Metadata
Metadata
Assignees
Labels
No labels