Nettakrim / Signed-Paintings

14 stars 3 forks source link

Implemented data compression for information about image. #25

Closed BondarenkoArtur closed 5 months ago

BondarenkoArtur commented 5 months ago

Implemented compression for images (It is backwards compatible, will update old sign to new version on change in GUI) Also in future this can allow to store data in binary, for example full float to get better precicion or multiple offsets/rotations

I went through pretty much all unicode characters to get how many pixels is required to render them in Minecraft. Majority in the list 1 pixel wide, but some 2. In comparison any number with default font is 6.

Tested locally with LAN server and also reverted commit for 1.20.1 and tested on 1.20.4 random public server

Here is some screenshots:

Disabled Paintings Enabled Paintings

Before Before After After

Nettakrim commented 5 months ago

oh wow that is incredibly cool

Nettakrim commented 5 months ago

ill probably add a command to toggle that but default it to compressed, since i do like the transparency of the plaintext

whats the rough amount of bytes it can store?

Nettakrim commented 5 months ago

mabye also a smart mode where it keeps it unconpressed if the data is small enough

Nettakrim commented 5 months ago

also i think resourcepacks can mess with the size of characters? but that doesnt matter

BondarenkoArtur commented 5 months ago

The reason why I want to add this, is to include additional amount of parameters. With this disabled they might not fit into regular uncompressed sign.

But I would say at least button for copy image URL is needed to be added for compressed.

whats the rough amount of bytes it can store?

I don't have exact number, but I would assume that it's around 1.3 pixel wide in average, so sign has 90 (if I'm not mistaken) 90*4=360/1.3~=275 bytes

BondarenkoArtur commented 5 months ago

Added two additional buttons for copying Url and uncompressed Data image

Nettakrim commented 5 months ago

ooh yeah that works, a z offset (and less often x offset), and being able to do it flush with floors/ceilings are the main things that get suggested for additional options, so being able to fit all of that is nice

Nettakrim commented 5 months ago

in like a week ill be going through all my mods and updating/fixing things, so ill merge this then

BondarenkoArtur commented 5 months ago

I have changes for X and Z and rotation, but I'm not sure if I should Include it into this CR, as this is getting too big. But changes depends on this code.

BondarenkoArtur commented 5 months ago

Is there anything else I should improve before it can be merged?

Nettakrim commented 5 months ago

looking through it properly now instead of the quick look i had earlier, it all seems good, my intellij is currently acting weird so i cant see it in action myself, but ill merge

BondarenkoArtur commented 5 months ago

Thanks will create second CR in a couple of hours when will be back home

BondarenkoArtur commented 5 months ago

From additional things that could be improved, we can use some compression alogrithm before converting bytes to lines on a sign. Like lzma or gzip. But needed to be tested if it's actually improving result