Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The @minecraft/vanilla-data module does not work #903

Open
Rasim100 opened this issue Aug 11, 2024 · 4 comments
Open

The @minecraft/vanilla-data module does not work #903

Rasim100 opened this issue Aug 11, 2024 · 4 comments

Comments

@Rasim100
Copy link

Rasim100 commented Aug 11, 2024

[Enter feedback here]

I am trying to throw the minecraft/vanilla-data module into the json manifest dependency, format version 2, when starting the game, it gives an error that an unknown module is dependent. Although npm i @minecraft/vanilla-data worked and I have the necessary module. Why is this happening and how do I use this module to work with vanilla items?

Here is the whole code of the manifest:
{
"format_version": 2,
"header": {
"name": "Dynamic Trees BP",
"description": "Made by New Perspectives company",
"min_engine_version": [1,21,0],
"uuid": "6c4a594d-d1f7-4577-8d17-23c19327a9e4",
"version": [1,0,0]
},
"modules": [
{
"description": "Made by New Perspectives company",
"type": "data",
"uuid": "96a695d6-5deb-44ae-8cb2-7ebb832abea2",
"version": [1,0,0]
},
{
"description": "This is script module",
"type": "script",
"language": "Javascript",
"uuid": "da00b5f6-4ca1-4457-900f-60f600314bd6",
"entry": "scripts/main.js",
"version": [1,0,0]
}
],
"dependencies": [
{
"uuid": "2f711ca7-69ed-4859-823f-572710c3b10f",
"version": [1,0,0]
},
{
"module_name": "@minecraft/server",
"version": "1.11.0"
},
{
"module_name": "@minecraft/server-ui",
"version": "1.2.0-beta"
},
{
"module_name": "@minecraft/server-gametest",
"version": "1.0.0-beta"
},
{
"module_name": "@minecraft/vanilla-data",
"version": "1.21.3"
}
]
}

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

@Visual1mpact
Copy link

vanilla-data is not an actual module. Remove it from the manifest. You have to download it using NPM and bundle it with your behavior pack. Your scripts which depends on it will need to target the correct path. It must be located within the scripts folder of your behavior pack.

@Zabadam
Copy link

Zabadam commented Sep 6, 2024

vanilla-data is not an actual module. Remove it from the manifest. You have to download it using NPM and bundle it with your behavior pack. Your scripts which depends on it will need to target the correct path. It must be located within the scripts folder of your behavior pack.

This is an excellent response but could be even better it it explained how one bundles the npm i assets.

@Visual1mpact
Copy link

vanilla-data is not an actual module. Remove it from the manifest. You have to download it using NPM and bundle it with your behavior pack. Your scripts which depends on it will need to target the correct path. It must be located within the scripts folder of your behavior pack.

This is an excellent response but could be even better it it explained how one bundles the npm i assets.

I bundle npm assets like @minecraft/math manually to ensure better control over file structures and avoid potential conflicts between modules. Using a custom script (copy-modules.js), I copy essential modules from node_modules into a specific directory. For certain modules like @minecraft/math, I also move and rename files, such as math-public.d.ts, to ensure smooth integration with TypeScript - rare cases. This process runs automatically after installing dependencies via an npm postinstall hook, making it efficient and reliable. A similar approach can be applied to bundle other modules like @minecraft/vanilla-data.

Some like to use something such as webpack or similar. Personal preference, however I do not use any such tools so I can't give guidance on it. I handle the bundling on my own accord.

https://github.com/Visual1mpact/Paradox_AntiCheat/blob/rewrite/package.json

@StealthyExpertX
Copy link

In my opinion, vanilla-data should be bundled with the game directly, so creators can use it without bundling it would help players a lot and lower the bar of entry for beginner programmers and creators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants