Skip to content

Custom items rework#872

Open
Huskydog9988 wants to merge 36 commits intoCivMC:mainfrom
Huskydog9988:custom-items-rework
Open

Custom items rework#872
Huskydog9988 wants to merge 36 commits intoCivMC:mainfrom
Huskydog9988:custom-items-rework

Conversation

@Huskydog9988
Copy link
Contributor

@Huskydog9988 Huskydog9988 commented Oct 15, 2025

Reworks the custom item interface as well as adds support for custom textures. Additionally, it migrates more custom items to proper custom items, for better fm config usability, plus removing the need to match items purely based on lore.

Fixes #737

version: ${version}
depend: [ CivModCore ]
softdepend: [ CivMenu, NameLayer, Citadel, Heliodor ]
softdepend: [ CivMenu, NameLayer, Citadel, Heliodor, EssenceGlue, Bastion, HiddenOre ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is more of a future issue, should items be registered by plugins or should we register them in CMC? FM will get chaotic with soft depends

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to move it all to CMC, same with the migration stuff, I just didn't want to rock the boat any more then I already am with this pr

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, I guess the other alternative would be maybe a CustomItems plugins that plugins can depend on but depends on thoughts @okx-code

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only issue here, is it possible to make the custom item config driven

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, but it would only get us so far. For very basic items like bastions and essence, which purely are just 'cosmetic' custom items, yea. For stuff like heliodor, I have no idea how you could even apply the block rules for example from a config without it getting messy fast. IMO, having it in the code is better, especially because these are supposed to be registered before any config loading is done since they can technically be used anywhere in the config.

Copy link
Contributor

@Diet-Cola Diet-Cola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall solid, downside is losing config driven custom items however this allows us to go further down the line. More worried about dependency stuff down the line if we stay with this approach however as mentioned in the comment

((loc.getBlockX() - location.getX()) * (float) (loc.getBlockX() - location.getX()) +
(loc.getBlockZ() - location.getZ()) * (float) (loc.getBlockZ() - location.getZ()) >= type.getRadiusSquared()))
);
(type.isSquare() && (Math.abs(loc.getBlockX() - location.getBlockX()) > type.getEffectRadius() || Math.abs(loc.getBlockZ() - location.getBlockZ()) > type.getEffectRadius())) || (!type.isSquare() && ((loc.getBlockX() - location.getX()) * (float) (loc.getBlockX() - location.getX()) + (loc.getBlockZ() - location.getZ()) * (float) (loc.getBlockZ() - location.getZ()) >= type.getRadiusSquared())));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove the formatting that made this readable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea your right, auto formatting error. I'll try and force the formatter to ignore.

@Protonull
Copy link
Contributor

Protonull commented Oct 23, 2025

It might be worth adding an item-tagging system while you're at it which would add an easy means to tag an item as compacted or as wordbanked. It could be as easy as storing a set of strings, that way testing for wordbank is just checking for the presence of "wordbank", instead of testing the internal structure of the text component, which is so cursed and apparently faulty (#278).

@Huskydog9988
Copy link
Contributor Author

A tag system probably is a better idea, I'm just not sure how too effectively handle the custom model data for example any differently. My current idea for it is to just add strings to a pdc. Would work great for wordbank stuff, but for compacted items, you just need to hope people use the compacted item method instead of checking the pdc manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

AddCustomModelData tags to All custom civ items.

4 participants

Comments