#Trying to make a falling block but I'm a little stuck

10 messages · Page 1 of 1 (latest)

midnight talon
#

I'm trying to make a block that when the support is removed will fall like sand, but I'm not sure how to do it correctly. Looking at the vanilla code I inherit from 45, but it requires a color code and I'm not sure how to make the number correctly. Or maybe I need a falling block in a different way?

public static final Block TEST_SAND = new SandBlock(new ColorCode(???), AbstractBlock.Settings.create().mapColor(MapColor.IRON_GRAY).something else);

alpine sinew
#

check what vanilla sand or gravel block does

midnight talon
# alpine sinew check what vanilla sand or gravel block does

Yes, I looked, the block class is inherited from SandBlock, but the parameters indicate a color code (presumably for coloring falling particles), but I can't figure out how to compose a color code so that it looks the way I need. I looked at the color code class and it says rgba(red-green-blue-alpha), but if compose by numbers, then according to rgba I get a 12-digit number, and in the game code the numbers are 6-digit...

alpine sinew
#

that's in decimal I'm assuming?

#

try seeing in/converting to hexadecimal, then you'll probably see that you get a number x and the game is half of that

#

in other words, the game uses less precise colours

#

(probably)

midnight talon
# alpine sinew (probably)

What's even stranger is that the vanilla color code for sand is 11098145, but the color code for gravel has a minus sign: -8356741. I'm totally confused...

alpine sinew
#

that's because of signed and unsigned stuff

#

convert them to hexadecimal and they'll be in a format that's more familiar