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

Avaritia Renders for MetaItems and Materials #2683

Open
wants to merge 180 commits into
base: master
Choose a base branch
from

Conversation

jude123412
Copy link

@jude123412 jude123412 commented Dec 16, 2024

What

I have added some Avaritia Methods to GT MetaItems and GT Materials.
This allows for all Material items and MetaItems to use Avaritia render's like Halo's behind items and Cosmic Effect for items.
Making Materials like Infinity or Cosmic Neutronium are missing these methods inside the Material Builder To give them Halo noise, Pulse effect, Halo, Halo Colour, Item Pulsing or Cosmic Effect. These new Renders are only active when Avaritia is installed because I'm using Avaritia to render everything.

I think what I have listed above is a good enough reason to accept this PR, This is somthing that I desire and many other do too.

Implementation Details

The MetaItem, Material MaterialBuilder should be checked they are where most of the methods are but other things in this PR could be checked too.

Outcome

This Pr will add support for Avaritia Renders Such as shouldDrawHalo, haloTexture, haloColour, haloSize, shouldDrawPulse, shouldDrawCosmic/maskTexturePath and maskOpacity to MetaItems and Materials in the Material Builder.

These Methods will only become active when Avaritia Is installed, When it is not the Methods do nothing.

Additional Information

These are a couple of the new render methods for Materials and MetaItems I made using the methods stated above.

Avaritia Halo and Cosmic Effect for NotANoob Certificate

image

Test Material With green coloured halo and Pulse Effect

Recording.2025-01-24.173559.mp4

Universium With Cosmic Effect

Recording.2025-01-24.173326.mp4

These are the Methods you can define inside the Material Builder.
They are all optional methods that are only active when Avaritia is installed.
.cosmic(boolean shouldDrawHalo, String haloTexture, String haloColour, int haloSize, boolean shouldDrawPulse, boolean shouldDrawCosmic, Float maskOpacity)
cosmic(boolean shouldDrawHalo, String haloTexture, String haloColour, int haloSize, boolean shouldDrawPulse)
cosmic(boolean shouldDrawHalo, String haloTexture, String haloColour, int haloSize)
cosmic( boolean shouldDrawCosmic, Float maskOpacity)
cosmic(boolean shouldDrawPulse)

shouldDrawHalo will set a Material set to draw a Halo, This will need also need haloTexture, haloColour and haloSize to be set.

haloTexture will get the halo from "gregtech:texture/items/cosmic/String haloTexture".

haloColour What colour the Halo will be as a Hex Value "FF00FF00" for Max Alpha and green

haloSize The size of the halo Max value of 10. defined as an Integer, 10 would be max size.

shouldDrawCosmic will generate the correct locations for textures of the Material Set, If the IconSet is set to DULL for instance, all Mask Textures are generated under "gregtech:textures/items/material_sets/dull/%s_mask." (%s is the item type, dust, ingot, gem).

maskOpacity Defines the opacity of the mask as a float, Max value 1.0f

These are the Methods you can define for any MetaItem.
They are all optional methods that are only active when Avaritia is installed.
.cosmicProperties(boolean shouldDrawHalo, String haloTexture, String haloColour, int haloSize, boolean shouldDrawPulse, String maskTexture, float maskOpacity)
.cosmicProperties(boolean shouldDrawHalo, String haloTexture, String haloColour, int haloSize, boolean shouldDrawPulse)
.cosmicProperties(boolean shouldDrawHalo, String haloTexture, String haloColour, int haloSize)
.cosmicProperties(String maskTexture, Float maskOpacity)
.cosmicProperties(boolean shouldDrawPulse)

These work the same as the Material builder accept they are on a per item basis and the mask Texture is defined as a string and will be under "gregtech:texture/items/cosmic/mask/String maskTexture".

Potential Compatibility Issues

Avaritia 1.1x wont work with these renders because that version doesn't have the ability to create an item with Cosmic and Halo Effects. Avaritia 1.1x Unofficial Extended Life contains everthing required for this to work as long as the version is greater than 3.3.0.42. Don't worry, If you have Avaritia 1.1x and not Avaritia 1.1x UEL these methods do nothing and won't crash the game.

serenibyss and others added 30 commits December 10, 2023 18:55
Co-authored-by: DStrand1 <[email protected]>
Co-authored-by: alongstringofnumbers <[email protected]>
@Oganesson897
Copy link

looks very similar to the code here, and with only minor changes, but I dont see any mention of the original author

@jude123412
Copy link
Author

Hmm, I should Probably ask the Owner of Avaritia for Permission to use some of there code

@jude123412
Copy link
Author

jude123412 commented Dec 20, 2024

I think You will need to credit them on this github page or at least Avaritia for using there methods xD. I have never done somthing like this before so ill be learning along the way!

Cleaner Code + Credits to Avaritia Owners
@Zorbatron Zorbatron added the type: feature New feature or request label Dec 20, 2024
added Api Files from Avaritia to fix an issue caused by them not being there
Run ./gradlew :spotlessCheck --warning-mode all --build-cache and ./gradlew :spotlessApply --warning-mode all to fix and clean code
I have received permission from Morpheus1101 to use some of Avaritia's code for this new patch.
Permission5 is what they said.
@jude123412 jude123412 requested a review from a team as a code owner December 22, 2024 10:13
@jude123412
Copy link
Author

I have just added permission5 to the pr, we are all ok to use some of there code here for this pr
image

Removed CosmicItemRenderer Class.
This has been Replaced By CosmicHaloItemRender from Avaritia.

Update Avaritia Dependencies
@jude123412
Copy link
Author

jude123412 commented Dec 28, 2024

I have Removed the CosmicItemRenderer Class and replaced it inside my own for of Avaritia. Makes the code on your end only relate to adding the renders to MetaItems and MetaPrefixItems :)

Remove Unnecessary option to set maskOpacity. Setting this Causes render bugs with the Infinity Armor Model.

Removed Fallback TextureAtlasSprite. Instead it is now set to null. when an Item isn't called with cosmic properties.
@jude123412
Copy link
Author

I have updated some of the classes and fixed some bugs related with the Cosmic Render.
These bugs were brought to light following the fix of a similar bug In Avaritia :D

Removed the need to convert String to Integer when setting Halo Colour for MetaItems and Material Items.
Update description of how to use these new methods, explaining how to use the new hex values.

Added a method I missed for CosmicProperty.
@jude123412
Copy link
Author

This PR is now ready to be reviewed by someone :)

@jude123412 jude123412 marked this pull request as draft January 22, 2025 21:06
@jude123412 jude123412 marked this pull request as ready for review January 22, 2025 21:09
Fixed Mod check to only allow Avaritia methods when Avaritia 1.1x Unoffical Extended Life version 3.3.0.42 or greater is installed.
If you use the Covers Avaritia 1.1x these methods won't work and now the wont crash the game.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.