From a02e2247135aa5eff030f205079e8c9cd3683a29 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Wed, 2 Jul 2014 20:05:33 +0100 Subject: [PATCH] Paintslinger lens fanciness. --- .../vazkii/botania/common/item/ItemLens.java | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/MODSRC/vazkii/botania/common/item/ItemLens.java b/MODSRC/vazkii/botania/common/item/ItemLens.java index d27fda7b1..ea7dde548 100644 --- a/MODSRC/vazkii/botania/common/item/ItemLens.java +++ b/MODSRC/vazkii/botania/common/item/ItemLens.java @@ -298,7 +298,7 @@ public class ItemLens extends ItemMod implements ILens { } case PAINT : { int storedColor = getStoredColor(stack); - if(!burst.isFake() && storedColor > -1 && storedColor < 16) { + if(!burst.isFake() && storedColor > -1 && storedColor < 17) { Block block = entity.worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ); if(paintableBlocks.contains(block)) { int meta = entity.worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ); @@ -307,13 +307,13 @@ public class ItemLens extends ItemMod implements ILens { ChunkCoordinates theseCoords = new ChunkCoordinates(pos.blockX, pos.blockY, pos.blockZ); coordsFound.add(theseCoords); - + do { List iterCoords = new ArrayList(coordsFound); for(ChunkCoordinates coords : iterCoords) { coordsFound.remove(coords); coordsToPaint.add(coords); - + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { Block block_ = entity.worldObj.getBlock(coords.posX + dir.offsetX, coords.posY + dir.offsetY, coords.posZ + dir.offsetZ); int meta_ = entity.worldObj.getBlockMetadata(coords.posX + dir.offsetX, coords.posY + dir.offsetY, coords.posZ + dir.offsetZ); @@ -323,9 +323,22 @@ public class ItemLens extends ItemMod implements ILens { } } } while(!coordsFound.isEmpty() && coordsToPaint.size() < 1000); - - for(ChunkCoordinates coords : coordsToPaint) - entity.worldObj.setBlockMetadataWithNotify(coords.posX, coords.posY, coords.posZ, storedColor, 2); + + for(ChunkCoordinates coords : coordsToPaint) { + int placeColor = storedColor == 16 ? entity.worldObj.rand.nextInt(16) : storedColor; + int metaThere = entity.worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ); + + if(metaThere != placeColor) { + entity.worldObj.setBlockMetadataWithNotify(coords.posX, coords.posY, coords.posZ, placeColor, 2); + float[] color = EntitySheep.fleeceColorTable[storedColor]; + float r = color[0]; + float g = color[1]; + float b = color[2]; + for(int i = 0; i < 4; i++) + Botania.proxy.sparkleFX(entity.worldObj, coords.posX + (float) Math.random(), coords.posY + (float) Math.random(), coords.posZ + (float) Math.random(), r, g, b, 0.6F + (float) Math.random() * 0.3F, 5); + + } + } } } break;