public static void LavaCheck(int x, int y)
{
Tile tile1 = Main.tile[x - 1, y];
Tile tile2 = Main.tile[x + 1, y];
Tile tile3 = Main.tile[x, y - 1];
Tile tile4 = Main.tile[x, y + 1];
Tile tile5 = Main.tile[x, y];
if ((int)tile1.liquid > 0 && !tile1.lava() || (int)tile2.liquid > 0 && !tile2.lava() || (int)tile3.liquid > 0 && !tile3.lava())
{
int num = 0;
int type = 56;
if (!tile1.lava())
{
num += (int)tile1.liquid;
tile1.liquid = (byte)0;
}
if (!tile2.lava())
{
num += (int)tile2.liquid;
tile2.liquid = (byte)0;
}
if (!tile3.lava())
{
num += (int)tile3.liquid;
tile3.liquid = (byte)0;
}
if (tile1.honey() || tile2.honey() || tile3.honey())
type = 230;
if (num < 24)
return;
if (tile5.active() && Main.tileObsidianKill[(int)tile5.type])
{
WorldGen.KillTile(x, y, false, false, false);
if (Main.netMode == 2)
NetMessage.SendData(17, -1, -1, "", 0, (float)x, (float)y, 0.0f, 0, 0, 0);
}
if (tile5.active())
return;
tile5.liquid = (byte)0;
tile5.lava(false);
WorldGen.PlaceTile(x, y, type, true, true, -1, 0);
WorldGen.SquareTileFrame(x, y, true);
if (Main.netMode != 2)
return;
NetMessage.SendTileSquare(-1, x - 1, y - 1, 3);
}
else
{
if ((int)tile4.liquid <= 0 || tile4.lava())
return;
if (Main.tileCut[(int)tile4.type])
{
WorldGen.KillTile(x, y + 1, false, false, false);
if (Main.netMode == 2)
NetMessage.SendData(17, -1, -1, "", 0, (float)x, (float)(y + 1), 0.0f, 0, 0, 0);
}
else if (tile4.active() && Main.tileObsidianKill[(int)tile4.type])
{
WorldGen.KillTile(x, y + 1, false, false, false);
if (Main.netMode == 2)
NetMessage.SendData(17, -1, -1, "", 0, (float)x, (float)(y + 1), 0.0f, 0, 0, 0);
}
if (tile4.active())
return;
if ((int)tile5.liquid < 24)
{
tile5.liquid = (byte)0;
tile5.liquidType(0);
if (Main.netMode != 2)
return;
NetMessage.SendTileSquare(-1, x - 1, y, 3);
}
else
{
int type = 56;
if (tile4.honey())
type = 230;
tile5.liquid = (byte)0;
tile5.lava(false);
tile4.liquid = (byte)0;
WorldGen.PlaceTile(x, y + 1, type, true, true, -1, 0);
WorldGen.SquareTileFrame(x, y + 1, true);
if (Main.netMode != 2)
return;
NetMessage.SendTileSquare(-1, x - 1, y, 3);
}
}
}