ComputerCraft

ComputerCraft

21M Downloads

Pallete getPaletteColour return number missmatch with orginals.

Wojbie opened this issue ยท 1 comments

commented

I noticed when creating a different version of multishell that returns from term.native().getPaletteColour() does not match numbers you provided it with.

Here is code that shows it in action. It should print 3 trues but it does not.

	c1,c2,c3 = math.random(),math.random(),math.random()
	term.native().setPaletteColor(colors.lime,c1,c2,c3)
	c4,c5,c6 = term.native().getPaletteColor(colors.lime)
	print( c1 == c4, c1 ,c4 , c1-c4)
	print( c2 == c5, c2 ,c5 , c1-c4)
	print( c3 == c6, c3 ,c6 , c1-c4)

It seems there is problem when number is translated from lua side to java side and back. Sadly i lack java skills and understanding how minecraft modding works to make it the fix myself.

Edit: I do realize this is related to floating point numbers accuracy.

commented

This doesn't seem that important, but if any one wants to fix it i would accept a PR which stored palette rgb values internally as doubles.