mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-05-17 23:04:10 +00:00
Merge pull request #259 from SquidDev-CC/hotfix/check-palette
Add some sanity checks to Palette.readFromNBT
This commit is contained in:
commit
ffa075cd3d
@ -89,8 +89,11 @@ public class Palette
|
|||||||
|
|
||||||
public void readFromNBT( NBTTagCompound nbt )
|
public void readFromNBT( NBTTagCompound nbt )
|
||||||
{
|
{
|
||||||
|
if( !nbt.hasKey( "term_palette" ) ) return;
|
||||||
int[] rgb8 = nbt.getIntArray( "term_palette" );
|
int[] rgb8 = nbt.getIntArray( "term_palette" );
|
||||||
|
|
||||||
|
if( rgb8.length != colours.length ) return;
|
||||||
|
|
||||||
for(int i = 0; i < colours.length; ++i)
|
for(int i = 0; i < colours.length; ++i)
|
||||||
{
|
{
|
||||||
colours[i] = decodeRGB8( rgb8[i] );
|
colours[i] = decodeRGB8( rgb8[i] );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user