Fix problem with negative item colors, which mostly come from the java version.

This commit is contained in:
IntegratedQuantum 2023-12-20 19:58:58 +01:00
parent 3eb3e2b358
commit 89438a2e2a

View File

@ -38,7 +38,7 @@ const Material = struct {
const colors = json.getChild("colors");
self.colorPalette = try allocator.alloc(Color, colors.JsonArray.items.len);
for(colors.JsonArray.items, self.colorPalette) |item, *color| {
const colorInt = item.as(u32, 0xff000000);
const colorInt: u32 = @intCast(item.as(i64, 0xff000000) & 0xffffffff);
color.* = Color {
.r = @intCast(colorInt>>16 & 0xff),
.g = @intCast(colorInt>>8 & 0xff),