Conversation
- Removed 217 fully transparent PNGs from `blocks/iconsets`. - Optimized `blocks/iconsets/VOID.png` to 1 pixel (126 → 80 bytes). - Updated the `BlockIcons` enum to use an optional fallback to `VOID.png`. This saves VRAM in the texture atlas while still allowing resource packs to override the icons if they provide their own resources.
Making basic machines overlay textures optional allowed the removal of 575 fully transparent PNGs.
Allowed the removal of 149 fully transparent PNGs.
Items might not have icon resources. If a resource is absent, the item uses the VOID icon, which is fully transparent. This allowed the removal of 2511 empty PNGs.
Rather than implementing several copies of VOID and ERROR_RENDERING textures, reuse thos already provided by the vanilla Texture Atlas Map
Allow GTPlusPlus to register item icons with Optional Resource assets and fallback to Global VOID icon.
Getting actual icon resource location png files is needed at many places. This commit centralize utility methods to compute this complete resource location from the resource/icon registry name.
Generate them locally where? Plus, 3000+ empty PNG files isn't any less scary than 3000+ lines of text.
I believe the only practical difference between required and optional assets is whether they get replaced with the magenta/black missingno texture, or a transparent empty texture. In this way, required assets are only there for the ease of finding bugs. |
Lower layer of block icons cannot be optional or it would make the block invisible and x-ray. For helping resource-pack creators, the processable list of textures is perfectly usable to create dummy files and directories. It is as simple as this one-liner I used in 30s: < logs/RegisterIcon.log awk -F: '/^O/{ print "assets/gregtech/"$2 }' | xargs -l1 install -D dummy.png |
Co-authored-by: VortexSo4 <kreker.maxim@mail.ru>
…EIOverlayForOutput (#5879)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
…nipulator. (#5853) Co-authored-by: lc-1337 <62835225+lc-1337@users.noreply.github.com>
Co-authored-by: Martin Robertz <dream-master@gmx.net>
…modules (#5828) Co-authored-by: VortexSo4 <kreker.maxim@mail.ru> Co-authored-by: chrombread <119648279+chrombread@users.noreply.github.com> Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: UltraProdigy <187078471+UltraProdigy@users.noreply.github.com>
Co-authored-by: Pxx500 <81298696+Pxx500@users.noreply.github.com> Co-authored-by: Martin Robertz <dream-master@gmx.net> Co-authored-by: Pxx500 <pbartulik@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Martin Robertz <dream-master@gmx.net> Co-authored-by: kuba6000 <kuba.123123.6000@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: VortexSo4 <kreker.maxim@mail.ru> Co-authored-by: Jakub <kuba.123123.6000@gmail.com> Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: VortexSo4 <kreker.maxim@mail.ru>
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Resolved conflicts Adapted to OptionalResources
59fb8c5 to
54472b5
Compare
|
@Dream-Master Merge conflicts from other PRs now resolved |
Reviewers: Here are some Notes to help your with this large PR
Instead of having thousands copy of the empty icon, 4 different copies of the RENDERING_ERROR and its overlay this patch replace all of these by internal already existing versions from the texture atlases.
It saves a huge amount of atlas space which in term also save a good amount fo the VRAM on the GFX card.
Incidentally, the ultimate best optimized texture is the texture than you can delete entirely.
Now blocks icons can declare their resource file optional, if so, when resource file is not available, it will fall back to a single reference to the fully transparent texture from the vanilla atlas, not even loading a resource from disk.
BlockIcon with Overlay defaults to optional resources.
All ItemIcons now default to optional resources.
An optional icon, even if not present in the JAR, might still be provided by Resources Pack. This now gives entire freedom for Resource Pack creator to provide the OVERLAY or GLOW OVERLAY they like on any face if it fits their style.
Deduplication of runnable custom icons registration, combined with the removal of empty png files, reduces the texture load/reload time by 13% (
F3+ttested 2.6s on master branch, 2.3s on this OptionalResource branch), this on a system with a very fast SSD. System with slower disk access will notice an ever greater speed gain.Now features an icons registration log file that can be activated:
config/GregTech/GregTech.cfg:logs/RegisterIcon.log:API Breaking Change in GT5U (GTNH fork): CustomIcons & Textures Enum
In an upcoming GT5U release (see PR: #5781), the following API changes are introduced:
CustomIcons constructors are deprecated
Direct instantiation will soon become impossible (the implementation classes will move to a non-public/internal package).
Reason: Bypasses caching, deduplication, and compile-time distinction of optional base textures.
Use the static factory methods instead:
BlockIcons.custom(String)→ base requiredBlockIcons.customOptional(String)→ base optional (falls back to invisible)BlockIcons.customAlpha(String)→ base required, rendered in pass 1ItemIcons.custom(String)→ base or overlay requiredMigration steps:
new CustomIcon(name)with the appropriate factory aboveCustomIcon→IIconContainerDeprecated enum constants in
Textures.ItemIconsandTextures.BlockIconsNULL→ useGlobalIcons.VOIDRENDERING_ERROR→ useGlobalIcons.RENDERING_ERRORApplies to both
ItemIconsandBlockIcons(identical names, same replacements).GlobalIconsentries are unified and safe for items and blocks.The old constants remain available during this transition release but will be removed in a future release.
Migration examples:
Validated tests:
runClient,runClient25runServerNotes for reviewers
3553 affected files?
This PR deletes 3459 PNG files. (Don't worry, those are all blank or error icons, now replaced by internal fallback)
Features
Main changes:
The
src/main/java/gregtech/api/enums/Textures.javaclass is where all of the important changes occurs.BlockIconsandItemIconsenumclasses have been refactored to standard final classes with the same backward-compatible constant names andIIconContainertype.IIconContainerandRunnableimplementations have been entirely removed from the API realm and moved to the internalgregtech.client.iconContainerspackage.CustomIconshave been provided for backward-compatiblenewinstanciation, while helping the migration to the new implementation-free factory methods.VOIDandRENDERING_ERRORIIconContainerconstants now refers to internal implementations which do not use a PNG resource file.Displaced implementations
These classes now internally provide both the
IIconContainerandRunnableimplementations within thegregtech.client.iconContainerspackage:Cascaded changes
Updated 83 classes to use to the new Textures Blocks or Items custom icons factories instead of the new deprecated
CustomIconsinstanciations.