mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-12 18:30:29 +00:00
Add some sanity checks to Palette.readFromNBT
Printers use a Terminal to store the page currently being printed. Printers saved in an older version of ComputerCraft would be missing the term_palette field, resulting in an NPE when loading the tile.
This commit is contained in:
parent
f3c291cb4d
commit
971c719a9f
@ -89,8 +89,11 @@ public class Palette
|
||||
|
||||
public void readFromNBT( NBTTagCompound nbt )
|
||||
{
|
||||
if( !nbt.hasKey( "term_palette" ) ) return;
|
||||
int[] rgb8 = nbt.getIntArray( "term_palette" );
|
||||
|
||||
if( rgb8.length != colours.length ) return;
|
||||
|
||||
for(int i = 0; i < colours.length; ++i)
|
||||
{
|
||||
colours[i] = decodeRGB8( rgb8[i] );
|
||||
|
Loading…
Reference in New Issue
Block a user