Paintslinger lens fanciness.

This commit is contained in:
Vasco Lavos committed 2014-07-02 20:05:33 +01:00
1 parent d7144a4a3e
commit a02e224713
1 file changed
+19 -6
@@ -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<ChunkCoordinates> 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;