-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Setup item texture and terrain texture file type
- Loading branch information
Showing
6 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
import { FormatVersion } from "../Types/FormatVersion"; | ||
|
||
const features = [ | ||
'minecraft:weighted_random_feature', | ||
'minecraft:aggregate_feature', | ||
'minecraft:cave_carver_feature', | ||
'minecraft:fossil_feature', | ||
'minecraft:geode_feature', | ||
'minecraft:growing_plant_feature', | ||
'minecraft:multiface_feature', | ||
'minecraft:nether_cave_carver_feature', | ||
'minecraft:ore_feature', | ||
'minecraft:partially_exposed_blob_feature', | ||
'minecraft:scatter_feature', | ||
'minecraft:search_feature', | ||
'minecraft:sequence_feature', | ||
'minecraft:single_block_feature', | ||
'minecraft:snap_to_surface_feature', | ||
'minecraft:structure_template_feature', | ||
'minecraft:surface_relative_threshold_feature', | ||
'minecraft:tree_feature', | ||
'minecraft:underwater_cave_carver_feature', | ||
'minecraft:vegetation_patch_feature' | ||
] | ||
|
||
/** */ | ||
export interface Feature extends Readonly<FormatVersion> { | ||
/** */ | ||
format_version: string; | ||
/** */ | ||
'minecraft:weighted_random_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:aggregate_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:cave_carver_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:fossil_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:geode_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:growing_plant_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:multiface_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:nether_cave_carver_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:ore_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:partially_exposed_blob_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:scatter_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:search_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:sequence_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:single_block_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:snap_to_surface_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:structure_template_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:surface_relative_threshold_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:tree_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:underwater_cave_carver_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
}, | ||
'minecraft:vegetation_patch_feature'?: { | ||
description: { | ||
identifier: string | ||
} | ||
} | ||
} | ||
|
||
/** */ | ||
export namespace Feature { | ||
/** | ||
* | ||
* @param value | ||
* @returns | ||
*/ | ||
export function is(value: any): value is Feature { | ||
if (value && typeof value.format_version === "string" && typeof value === 'object') { | ||
const keys = Object.keys(value) | ||
const type = features.filter(feature => keys.includes(feature))[0] | ||
if (type && typeof value[type].description === 'object' && typeof value[type].description.identifier === 'string') return true | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { Types } from "bc-minecraft-bedrock-types"; | ||
|
||
/** */ | ||
export interface Feature extends Types.BaseObject { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as internal from "../../../Internal/BehaviorPack/Feature"; | ||
import { Json } from "../../../Internal/Json"; | ||
import { Molang } from "bc-minecraft-molang"; | ||
import { Types } from "bc-minecraft-bedrock-types"; | ||
import { Documentation } from "../../../Types/Documentation"; | ||
import { TextDocument } from "../../../Types/TextDocument"; | ||
import { Feature } from "./Feature"; | ||
|
||
/** | ||
* | ||
* @param doc | ||
* @returns | ||
*/ | ||
export function Process(doc: TextDocument): Feature | undefined { | ||
const uri = doc.uri; | ||
const content = doc.getText(); | ||
const imp = Json.To<internal.Feature>(doc); | ||
|
||
if (!internal.Feature.is(imp)) return undefined; | ||
|
||
//@ts-ignore | ||
const container = imp[Object.keys(imp).filter(x => !x.startsWith('format_version'))[0]] | ||
const id = container.description.identifier; | ||
|
||
const out: Feature = { | ||
id: id, | ||
location: Types.Location.create(uri, content.indexOf(id)), | ||
documentation: Documentation.getDoc(doc, () => `Feature: ${id}`), | ||
}; | ||
|
||
return out; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* Auto generated */ | ||
|
||
export * from "./Feature"; | ||
export * from "./Process"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters