Prevent paint lens from painting blocks illegal colors

This commit is contained in:
Vincent Lee committed 2016-04-14 22:39:26 -05:00
1 parent 8c3d1bde14
commit f01b8a1fa9
1 file changed
+2 -1
@@ -71,7 +71,8 @@ public class LensPaint extends Lens {
EnumDyeColor placeColor = EnumDyeColor.byMetadata(storedColor == 16 ? entity.worldObj.rand.nextInt(16) : storedColor);
IBlockState stateThere = entity.worldObj.getBlockState(coords);
if(stateThere.getValue(BotaniaAPI.paintableBlocks.get(block)) != placeColor) {
if(stateThere.getValue(BotaniaAPI.paintableBlocks.get(block)) != placeColor
&& BotaniaAPI.paintableBlocks.get(block).getAllowedValues().contains(placeColor)) {
entity.worldObj.setBlockState(coords, stateThere.withProperty(BotaniaAPI.paintableBlocks.get(block), placeColor), 2);
int hex = placeColor.getMapColor().colorValue;
int r = (hex & 0xFF0000) >> 16;