Skip to content

Commit

Permalink
πŸ”§ configure model display items and custom_model_data offsets (#224)
Browse files Browse the repository at this point in the history
* πŸ”§ switch AJ display item to `pink_dye`

* πŸ”§ change configs from `white_dye` to `pink_dye`

* πŸ”¨ add lint-rule to fix `custom_model_data_offset` AJ model property

* πŸ”§ update CMD offset for AJ model files

* πŸ”¨ add lint-rule to check `custom_model_data_offset` AJ model property

* πŸ”§ enable adv resourcepack flag for AJ model files

* πŸ‘· fix build failing due to `store_position` being deleted

* πŸ”§ prune `gray_dye` model file from build
- Summit will likely already have this setup on their end

* πŸ”§ update CMD offset for non-AJ model files

* πŸ§‘β€πŸ’» add admin function to remove the petal pipe models
- nice for performance A/B testing since we already know they are very taxing on the server
  • Loading branch information
TheAfroOfDoom authored Oct 12, 2024
1 parent ad048b4 commit 6295439
Show file tree
Hide file tree
Showing 46 changed files with 171 additions and 113 deletions.
4 changes: 2 additions & 2 deletions .github/actions/setup-animated-java-exports/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ runs:
datapacks/animated_java/data.ajmeta
resourcepack/assets.ajmeta
resourcepack/assets/animated_java
resourcepack/assets/minecraft/models/item/white_dye.json
resourcepack/assets/minecraft/models/item/pink_dye.json
resourcepack/assets/omega-flowey/models/last_exported_hashes.json
- run: bash ${{ github.action_path }}/install-animated-java-and-run-auto-exporter.sh
if: ${{ steps.cache-animated-java-exports.outputs.cache-hit != 'true' }}
Expand All @@ -32,5 +32,5 @@ runs:
datapacks/animated_java/data.ajmeta
resourcepack/assets.ajmeta
resourcepack/assets/animated_java
resourcepack/assets/minecraft/models/item/white_dye.json
resourcepack/assets/minecraft/models/item/pink_dye.json
resourcepack/assets/omega-flowey/models/last_exported_hashes.json
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ datapacks/animated_java/data
datapacks/animated_java/data.ajmeta
resourcepack/assets.ajmeta
resourcepack/assets/animated_java
resourcepack/assets/minecraft/models/item/white_dye.json
resourcepack/assets/minecraft/models/item/pink_dye.json

## temp files
# old world folders that have been backed up after running `yarn down`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ function omegaflowey.utils:log/self { text_component: '[ \
{ "text": "kill/bossfight", "color": "yellow" }, \
": ends the bossfight and kills related entities (if active)", \
"\\n", \
{ "text": "kill/petalpipes", "color": "yellow" }, \
": kills the performance-heavy AJ petal pipe models", \
"\\n", \
{ "text": "kill/queue", "color": "yellow" }, \
": resets the bossfight player queue" \
] \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
function omegaflowey.admin:kill/bossfight
function omegaflowey.admin:kill/decorations
function omegaflowey.admin:kill/petalpipes
function omegaflowey.admin:kill/queue
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function omegaflowey.utils:log { text_component: '[ \
{ "selector": "@s", "color": "gold" }, \
{ "text": " killed the petal pipe models", "color": "yellow" } \
]'}
function animated_java:omegaflowey_petal_pipe_circle/remove/all
function animated_java:omegaflowey_petal_pipe_middle/remove/all
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
give @s carved_pumpkin[ \
minecraft:custom_model_data=1, \
minecraft:custom_model_data=4654465, \
minecraft:rarity=rare, \
minecraft:enchantment_glint_override=false, \
minecraft:fire_resistant={}, \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
give @s carved_pumpkin[ \
minecraft:custom_model_data=2, \
minecraft:custom_model_data=4654466, \
minecraft:rarity=epic, \
minecraft:enchantment_glint_override=true, \
minecraft:fire_resistant={}, \
Expand Down
2 changes: 1 addition & 1 deletion package-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const allAnimatedJavaExportFiles = [
'datapacks/animated_java/data.ajmeta',
'resourcepack/assets.ajmeta',
'resourcepack/assets/animated_java',
'resourcepack/assets/minecraft/models/item/white_dye.json',
'resourcepack/assets/minecraft/models/item/pink_dye.json',
`${ajblueprintDir}/last_exported_hashes.json`,
];
const allAnimatedJavaExportFilesFormatted =
Expand Down
6 changes: 5 additions & 1 deletion package-scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ const getSummitDatapackPaths = () => {
'move_forward.mcfunction',
'shake_screen_macro.mcfunction',
'shake_screen.mcfunction',
'store_position.mcfunction',
]);

const entityPaths = prefixPaths('omegaflowey.entity/', [
Expand Down Expand Up @@ -235,6 +234,11 @@ const getSummitResourcepackPaths = () => {
...minecraftPaths,
...omegaFloweyPaths,
]);
const removeGrayDye = async ({ compiledPath }) => {
const grayDyeFile = `${compiledPath}/assets/minecraft/models/item/gray_dye.json`;
await rimraf(grayDyeFile);
};
postProcessors.push(removeGrayDye);

const resourcepackPaths = prefixPaths('resourcepack/', [
'pack.mcmeta',
Expand Down
46 changes: 45 additions & 1 deletion package-scripts/linting-rules/correct-ajblueprint-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,28 @@ const checkAnimationName = (model, { file }) => {
return errors;
};

/**
* Custom model data offset need to be some large, arbitrary value to avoid collision
* with other Summit booths
*/
const checkCustomModelDataOffset = (model) => {
const errors = [];

const expectedCMDOffset = 4654465;
const cmdOffset = model.blueprint_settings.custom_model_data_offset;
const isValidCMDOffset = expectedCMDOffset === cmdOffset;
if (!isValidCMDOffset) {
let error = `custom model data offset is incorrect: `;
error += chalk.redBright(cmdOffset);
error += ` (expected `;
error += chalk.blueBright(expectedCMDOffset);
error += ` )`;
errors.push(error);
}

return errors;
};

const checkDatapack = (model) => {
const expected = /datapacks\/animated_java\/?$/;
const actual = model.blueprint_settings.data_pack;
Expand All @@ -47,6 +69,26 @@ const checkDatapack = (model) => {
return [error];
};

/** This flag needs to be enabled to enable the custom CMD offset */
const checkEnableAdvancedResourcePackSettings = (model) => {
const errors = [];

const expected = true;
const actual =
model.blueprint_settings.enable_advanced_resource_pack_settings;
const isValid = actual === expected;
if (!isValid) {
let error = `custom model data offset is incorrect: `;
error += chalk.redBright(actual);
error += ` (expected `;
error += chalk.blueBright(expected);
error += ` )`;
errors.push(error);
}

return errors;
};

/**
* Export namespaces need to start with `omegaflowey_` (e.g. `omegaflowey_mouth`)
* in order to be compatible with Smithed Summit
Expand All @@ -67,7 +109,7 @@ const checkExportNamespace = (model) => {
};

const checkRigItem = (model) => {
const expected = 'minecraft:white_dye';
const expected = 'minecraft:pink_dye';
const actual = model.blueprint_settings.display_item;
if (actual === expected) {
return [];
Expand Down Expand Up @@ -107,7 +149,9 @@ const correctAjblueprintSettings = (file) => {

const settingsChecks = [
checkAnimationName,
checkCustomModelDataOffset,
checkDatapack,
checkEnableAdvancedResourcePackSettings,
checkExportNamespace,
checkRigItem,
checkSummonCommands,
Expand Down
2 changes: 1 addition & 1 deletion package-scripts/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const watchResourcepack = async (showVerbose) => {
/** silenced files are still watched, but aren't logged */
const silenced = [
/^resourcepack[/\\]assets[/\\]animated_java/,
/^resourcepack[/\\]assets[/\\]minecraft[/\\]models[/\\]item[/\\]white_dye\.json$/,
/^resourcepack[/\\]assets[/\\]minecraft[/\\]models[/\\]item[/\\]pink_dye\.json$/,
];
const isSilenced = (path) => silenced.some((pattern) => pattern.test(path));
const copyFilter = (path) => ignored.every((regex) => !regex.test(path));
Expand Down
4 changes: 2 additions & 2 deletions resourcepack/assets/minecraft/models/item/carved_pumpkin.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"overrides": [
{
"predicate": {
"custom_model_data": 1
"custom_model_data": 4654465
},
"model": "omega-flowey:entity/decorative/reward_hat"
},
{
"predicate": {
"custom_model_data": 2
"custom_model_data": 4654466
},
"model": "omega-flowey:entity/decorative/reward_hat_cyan"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"enable_plugin_mode": false,
"resource_pack_export_mode": "raw",
"data_pack_export_mode": "raw",
"display_item": "minecraft:white_dye",
"custom_model_data_offset": 0,
"enable_advanced_resource_pack_settings": false,
"display_item": "minecraft:pink_dye",
"custom_model_data_offset": 4654465,
"enable_advanced_resource_pack_settings": true,
"enable_advanced_resource_pack_folders": false,
"resource_pack": "G:/Coding/omegaflowey-minecraft-remastered/resourcepack",
"display_item_path": "",
Expand Down
Loading

0 comments on commit 6295439

Please sign in to comment.