spgoding / resource-pack-converter Goto Github PK
View Code? Open in Web Editor NEW(WIP) A npm package that provides method to convert Minecraft: Java Edition resource packs from a version to another version.
License: MIT License
(WIP) A npm package that provides method to convert Minecraft: Java Edition resource packs from a version to another version.
License: MIT License
assets/minecraft/textures/items/clock.png.mcmeta
minecraft:item/clock
doesn't existSplit texture minecraft:items/clock
.
Split model minecraft:item/clock
and the texture defined in it.
The new PathAdapter should still provide methods to change paths (or we call the namespaced strings) of specific files.
The new PathAdapterOptions should be like this:
interface PathAdapterOptions {
operations: {
filter: FileFilter,
set: string
}[]
}
class FileFilter {
constructor(
private readonly type: string,
private readonly namespacedIDs: RegExp[],
private readonly extensions: string[]
) { }
public test() {
throw new Error('Method not implemented.')
}
}
So now we can change the previous PathAdapter constructions defined in conversions to this:
new PathAdapter({
operations: [
filter: new FileFilter('textures', [/^minecraft:items\/fish_raw$/], ['png', 'png.mcmeta']),
set: 'minecraft:items/fish_cod_raw'
}
]
})
When a conversion begin, get an object called whole
containing all blockstates and models.
Then, run adapter factories to get adapters. An adapter factory will return adapter(s) according to the whole
. Adapters provided by adapter factories will be appended in the adapters
filed of the conversion.
e.g. The ClockAdapterFactory
will return an ClockAdapter
which will split specfic textute defined in model minecraft:item/clock
.
It will also be great to generate human-readable documents about what an adapter does.
Combine models to a simple model for hences, glass panes, etc.
e.g. Namespaced IDs in blockstates and models.
assets/minecraft/models/item/compass.json
assets/minecraft/textures/items/compass.png.mcmeta
assets/minecraft/textures/items/compass.png
to /minecraft/textures/items/compass_${x}.png
.See also: #9
We have changed PathAdapter before in #7, but that's incompleted. Since models were introduced in JE1.8 and blockstates were introduced in JE1.9, the namespaced IDs of textures are not fixed anymore.
In JE1.8, models determine the namespaced IDs of textures. In JE1.9, blockstates determine the namespaced IDs of block models.
So when wiring the conversion of JE1.8 into JE1.9, what we should do is not to change textures locations, but to change the locations of models accordingly. Only if the model is omitted in the resource pack, we should apply the changes of models in vanilla resource pack to the textures.
So, don't split texture minecraft:items/clock
hardcodely, but to split textures defined in model minecraft:item/clock
. To implement this, we need an object like this:
{
"models": {
"minecraft:item/clock": {
"parent": "builtin/clock",
"textures": {
"...": "....."
}
},
"...": {}
}
}
And we merge the model definitions in input resource pack (identified with "RPC$isReplaced": true
) with the object. At last we find out the specific model, check if the parent
is set to builtin/clock
, get the namespaced ID of clock texture, split textures (and models if RPC$isReplaced
).
/**
* Reprensets an resource in the resource pack.
*/
export interface Resource {
/**
* The content of the resource.
*/
content: Buffer,
/**
* The type of the resource.
*/
type: string
/**
* The namespaced string of the resource.
*/
namespacedString: string
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.