ColoredGlow Lib

ColoredGlow Lib

50.7k Downloads

Rainbow Glow Not Working

fzzyhmstrs opened this issue · 15 comments

commented

Hello, I'm using your GlowLib version 1.0.0 in my mod (https://github.com/fzzyhmstrs/ai/tree/1.18.1), and I can't get the rainbow glowing effect to work. I set the entity to have rainbow color, but it doesn't show up in game.

I did some checking, and the setRainbowColorToEntity doesn't seem to be setting anything. I checked with getEntityRainbowColor immediately after setting, and it comes back false. Not sure what I could be doing wrong here. Here's the snippet of code I'm using:

(GlowColorUtil is my Object)

if (GlowColorUtil.oreIsRainbow(entityBlock)){
                ColoredGlowLib.setRainbowColorToEntity(this,true)
                println("i'm a ranibow")
                println(ColoredGlowLib.getEntityRainbowColor(this))  //this is displaying as false even though I just set it to true two line prior
            } else {
                val color = GlowColorUtil.oreGlowColor(entityBlock)
                ColoredGlowLib.setColorToEntity(this, color)
            }
            this.addStatusEffect(StatusEffectInstance(StatusEffects.GLOWING, 260))

This is the console output of the two printlns:
image

And this is what I see in game. You can see that the other visible (and underground) ore blocks are showing various colors. The Ancient Debris, however, is showing as plain white instead of the desired rainbow. It is properly identifying as needing a rainbow via oreIsRainbow.
image

I even mixed in to your code and println'ed my own entitytype_rainbow_list.contains(entity.getUuid()), and that came back TRUE, which is a very fascinating outcome. I do not know how I can get a different result at the head of the getEntityRainbowColor method compared to at the return statement!

commented

Can i close the issue now?

commented
commented

Nah don't worry. Thank you for the report btw!

commented

Took me a while, but it should be working now.

commented

Took me a while, but it should be working now.

Sorry to beleaguer this issue, but I'm now getting getting game crashes. I can build and runClient with 1.0.1, that is fixed. But Java is throwing a Number Format Exception almost as soon as the game loads:

Description: Unexpected error

java.lang.NumberFormatException: For input string: "2a2a2a"
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
	at java.base/java.lang.Integer.parseInt(Integer.java:668)
	at java.base/java.lang.Integer.valueOf(Integer.java:973)
	at java.base/java.lang.Integer.decode(Integer.java:1458)
	at me.emafire003.dev.coloredglowlib.util.Color.translateFromHEX(Color.java:212)
	at me.emafire003.dev.coloredglowlib.ColoredGlowLib.getEntityColor(ColoredGlowLib.java:201)
	at net.minecraft.entity.Entity.entitySpecificColor(Entity.java:3722)
	at net.minecraft.entity.Entity.handler$zfd000$injectChangeColorValue(Entity.java:3773)
	at net.minecraft.entity.Entity.getTeamColorValue(Entity.java:329)

Seems it's because the hexadecimal symbol # is being removed from the hex_color string in translateFromHEX. I can get it to decode with the # intact ("#2a2a2a")

I think this is expected behavior, as Integer.decode defaults to base 10 unless one of the symbol specifiers are used.

commented

Cool it seams i've fixed a bug that wasn't a bug creating a new bug. I'll upload the correct jar in a few seconds to the same version so try rebuliding.

commented

Getting error when building with refresh dependencies

> Could not resolve all dependencies for configuration ':modImplementation'.
   > Could not find maven.modrinth:coloredglowlib:1.0.1.
   Searched in the following locations:
   ....
   ....
   https://api.modrinth.com/maven/maven/modrinth/coloredglowlib/1.0.1/coloredglowlib-1.0.1.pom
commented

Uh. No idea why that happened. Welp, now there is 1.1.0 so try with that, it should work since I just updated it on my other project.

commented

Intresting, i will look into it but it may be a while since i am very busy these days. Also, this works only on client side, i thought i had it working on the server side too but i imagined it probably. And yeah that will need to be worked on too... eh. Maybe a week or so or maybe less i don't know. Btw, are you using kotlin? Anyway, try to get the map itself and put the entity in there, the method for some reason behaved strangely sometimes, maybe in the future i'll just give out the map itself if this keeps happening.

commented

Intresting, i will look into it but it may be a while since i am very busy these days. Also, this works only on client side, i thought i had it working on the server side too but i imagined it probably. And yeah that will need to be worked on too... eh. Maybe a week or so or maybe less i don't know. Btw, are you using kotlin? Anyway, try to get the map itself and put the entity in there, the method for some reason behaved strangely sometimes, maybe in the future i'll just give out the map itself if this keeps happening.

Totally understand if you are busy. The error is more strange than progress-stopping. I can always take the 'out' of mixing into the getEntityRainbowColor method as described above and replace your return with my cir.setReturnValue, which for some reason is working.

I'll add a client-side check to see if that works things out. Makes sense it would be client-side as it's dealing with rendering.

Yes I am using Kotlin. I prefer it to java in most cases.

commented
commented

Yes you are correct, i wrote the message and then deleted it shortly afterwards because i remembered that it just set the rainbow color for every entity and it's not a condition like enabled/disabled. Anyway, i think i found the cause and, unsurprisingly, it looks like it was just a typo. I also rewrote the method that renders the color to be more clean and possibily less buggy. In the meantime i've also started working on a way to save the data on a file permanently but it needs a bit more work, so you will have to wait until tomorrow for a release.

commented

Try to update to 1.0.1 and see if it works

commented

Try to update to 1.0.1 and see if it works

is this the right dependency notation?: maven.modrinth:coloredglowlib:1.0.1

I'm getting an error 403 Forbidden when I try to build with it.

commented

Yes it is but modrinth decided to be very collaborative this time it seems... probably something went wrong on uploading the jar I guess. I'll have to fix it in a bit